re: The Pythonic Guide To Logging VIEW POST


First of all, wonderful post.
I'm working on a Flask application right now: first time with Python and I was looking for useful information about how to write logs the right way when I saw this post — awesome!

Anyway, I tried to copy & paste the code but it looks like the logger object doesn't care about the format you passed to logging.basicConfig if you are using the FileHandler and you've to explicitly call .setFormatter to make it know.

log_formatter = logging.Formatter('%(asctime)s - %(levelname)s --: %(message)s')

file_handler = logging.FileHandler('logfile')

Might wanna look at the docs at the app specific logger it also shows how to do some useful stuff like access library loggers and such

code of conduct - report abuse