How to change the format of logged messages temporarily, in Python?

Here is a simple solution, that can be deduced from Vinay Sajip’s own HOWTO; it basically updates the logging formatter with setFormatter(): import logging logger = logging.getLogger() # Logger logger_handler = logging.StreamHandler() # Handler for the logger logger.addHandler(logger_handler) # First, generic formatter: logger_handler.setFormatter(logging.Formatter(‘%(message)s’)) logger.error(‘error message’) # Test # New formatter for the handler: logger_handler.setFormatter(logging.Formatter(‘PROCESSING FILE … Read more

Is it possible to specify custom error log format on Nginx?

You can’t specify your own format, but in nginx build-in several level’s of error_log-ing. Syntax: error_log file [ debug | info | notice | warn | error | crit ] Default: ${prefix}/logs/error.log Specifies the file where server (and fastcgi) errors are logged. Default values for the error level: in the main section – error in … Read more

Simple way to perform error logging?

I wouldn’t dig too much on external libraries since your logging needs are simple. .NET Framework already ships with this feature in the namespace System.Diagnostics, you could write all the logging you need there by simply calling methods under the Trace class: Trace.TraceInformation(“Your Information”); Trace.TraceError(“Your Error”); Trace.TraceWarning(“Your Warning”); And then configure all the trace listeners … Read more