Search code examples
pythonloggingtimezoneutcpython-logging

How to set timestamps on GMT/UTC on Python logging?


Is it possible and how to set the logging timezone to GMT?

(i.e. the %(asctime)s parameter in the format)


Solution

  • logging.Formatter.converter = time.gmtime
    

    (documented in the docstring of logging.Formatter.formatTime)