Opened 5 years ago

Last modified 5 years ago

#31537 closed Uncategorized

Optionally log server_time with timzone — at Version 1

Reported by: thenewguy Owned by: nobody
Component: Core (Other) Version: 3.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by thenewguy)

It would be helpful if logging format included the timezone for the logged time. When this information is parsed (for example log aggregation via logstash) the timezone data would be very helpful to create a consistent timestamp.

For reference, https://docs.python.org/3/library/logging.html

Changed in version 3.3: Previously, the default format was hard-coded as in this example: 2010-09-06 22:38:15,292 where the part before the comma is handled by a strptime format string ('%Y-%m-%d %H:%M:%S'), and the part after the comma is a millisecond value. Because strptime does not have a format placeholder for milliseconds, the millisecond value is appended using another format string, '%s,%03d' — and both of these format strings have been hardcoded into this method. With the change, these strings are defined as class-level attributes which can be overridden at the instance level when desired. The names of the attributes are default_time_format (for the strptime format string) and default_msec_format (for appending the millisecond value).

Since the date time output is not created via one format operation it is more complicated than just adding %Z or %z to the format string.

Happy to do the work. Please provide feedback/direction.

Change History (1)

comment:1 by thenewguy, 5 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top