How to set timestamps on GMT/UTC on Python logging?
Solution 1:
logging.Formatter.converter = time.gmtime
(documented in the docstring of logging.Formatter.formatTime
)
Solution 2:
Just setting logging.Formatter.converter = time.gmtime
is ineffective for me in Python 2.5.
So I created a child class with it set, and use that in place of logging.Formatter:
class UTCFormatter(logging.Formatter):
converter = time.gmtime