Ryan Harper has proposed merging ~raharper/cloud-init:logging-gmtime into cloud-init:master.
Requested reviews: cloud-init commiters (cloud-init-dev) For more details, see: https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/329122 Configure logging module to always use UTC time (time.gmtime()) Currently the python logging module will default to a local time which may contain an TZ offset in the values it produces. Switching to UTC time for logging produces consistent values in the cloud-init.log file and avoids issues when the timezone is changed during boot. -- Your team cloud-init commiters is requested to review the proposed merge of ~raharper/cloud-init:logging-gmtime into cloud-init:master.
diff --git a/cloudinit/log.py b/cloudinit/log.py index 3861709..3a21ad2 100644 --- a/cloudinit/log.py +++ b/cloudinit/log.py @@ -19,6 +19,8 @@ import sys import six from six import StringIO +import time + # Logging levels for easy access CRITICAL = logging.CRITICAL FATAL = logging.FATAL @@ -32,6 +34,8 @@ NOTSET = logging.NOTSET # Default basic format DEF_CON_FORMAT = '%(asctime)s - %(filename)s[%(levelname)s]: %(message)s' +# Always format logging timestamps as UTC time +logging.Formatter.converter = time.gmtime def setupBasicLogging(level=DEBUG): root = logging.getLogger()
_______________________________________________ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp