Milliseconds in logging format

I

Irmen de Jong

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top