Reputation: 40624
In the console I can see the logging messages formatted in the way I specified. However when I inspect the log file all I can see is the message
part of original log entries.
Here is how I set up the logger when the program starts
LOG_FORMAT="%(asctime)-15s pid %(process)6d tid %(thread)4d %(levelname)-8s %(module)-8s %(message)s"
logging.basicConfig(format=LOG_FORMAT)
file_handler = logging.handlers.RotatingFileHandler(logfile_name)
logger = logging.getLogger(module_name)
logger.addHandler(file_handler)
How can make the file logger also respect the format setting?
Upvotes: 1
Views: 847