Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Milliseconds in logging format

Reply
Thread Tools

Milliseconds in logging format

 
 
Joan Miller
Guest
Posts: n/a
 
      01-10-2010
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/loggi...#basic-example

[2] http://docs.python.org/library/time.html#time.strftime
 
Reply With Quote
 
 
 
 
Irmen de Jong
Guest
Posts: n/a
 
      01-10-2010
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/loggi...#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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert x (elapsed) milliseconds into human-readable format "..d..h..m..s" ? Ulf Meinhardt Java 0 09-13-2009 07:58 AM
Simple Date Format - milliseconds with more precision brisco5@gmail.com Java 5 03-09-2005 01:27 AM
formatting time as milliseconds in logging module Stefan Behnel Python 6 10-20-2004 09:16 AM
What a mess: Date, milliseconds, GregorianCalendar Erwin Moller Java 80 08-27-2004 11:05 AM
Newbie Question: How to return the current time in seconds or milliseconds? Michelle Java 5 08-17-2004 05:44 AM



Advertisments