#31537: Optionally log server_time with timezone
-------------------------------+--------------------------------------
     Reporter:  thenewguy      |                    Owner:  nobody
         Type:  Uncategorized  |                   Status:  new
    Component:  Uncategorized  |                  Version:  3.0
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------
Description changed by thenewguy:

Old description:

> 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.

New description:

 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.

 It seems like the simplest way to do this would be to always log in UTC
 and add the "Z" for timezone.  But +-offset could also be used if
 localtime needs to be supported

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31537#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.d30426986afb9a1d802ccfea1c09c05b%40djangoproject.com.

Reply via email to