logging.LogRecord asctime aattribute - easily override somehow?
skip.montanaro at gmail.com
Wed Mar 29 13:07:35 EDT 2017
>>> import logging
>>> logging.basicConfig(format="%(asctime)s" + logging.BASIC_FORMAT, datefmt="***%A***")
Thanks, Peter. I suppose a bit more detail of my environment would
have helped. I'm actually using the logging package indirectly via
Flask. After a quick skim of Flask's code, it didn't look like the
Flask author considered that users might want to do their own thing
with logging. I think I could override the Flask.logger property and
chuck in something like your code. I'll just suffer for the time being
with my "two word" timestamps. Whoever thought you'd want to break up
timestamps into two words by default, and hard-code a comma as the
separator between seconds and milliseconds?
Just for the record, for my own standalone code I never use the
logging module. I just have a simple Logger class which does all I
need. The logging module (and log4j) have always seemed to me to be an
overly general solution in search of a problem.
More information about the Python-list