Milliseconds in logging format

Discussion in 'Python' started by Joan Miller, Jan 10, 2010.

  1. Joan Miller

    Joan Miller Guest

    Joan Miller, Jan 10, 2010
    #1
    1. Advertising

  2. On 10-1-2010 20:04, Joan Miller wrote:
    > How the logging '%(asctime)s' [1] specifier to gets the millisecond
    > portion of the time if there is not a directive to get it from the
    > time module [2] ?
    >
    >
    > "The date format string follows the requirements of strftime()"
    > [1] http://docs.python.org/library/logging.html#basic-example
    >
    > [2] http://docs.python.org/library/time.html#time.strftime


    It appends them to the string that strftime() returned.
    If you set a custom datefmt, it will stop doing this and you'll have to
    use %(msecs) in your log format to get them back.

    See the source, Lib/logging/__init__.py around line 400. (Python 2.6.4)

    -irmen
    Irmen de Jong, Jan 10, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stefan Siegl
    Replies:
    0
    Views:
    932
    Stefan Siegl
    Aug 27, 2003
  2. janne
    Replies:
    0
    Views:
    9,428
    janne
    Sep 10, 2004
  3. Replies:
    5
    Views:
    72,151
    Lee Fesperman
    Mar 9, 2005
  4. Stefan Behnel
    Replies:
    6
    Views:
    537
    Vinay Sajip
    Oct 20, 2004
  5. Ulf Meinhardt
    Replies:
    0
    Views:
    478
    Ulf Meinhardt
    Sep 13, 2009
Loading...

Share This Page