How to set timestamps on GMT/UTC on Python logging?
From the python 3 docs:
import time
class UTCFormatter(logging.Formatter):
converter = time.gmtime
https://docs.python.org/3/howto/logging-cookbook.html#formatting-times-using-utc-gmt-via-configuration
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
logging.Formatter.converter = time.gmtime
(documented in the docstring of logging.Formatter.formatTime
)