Skip to content

Instantly share code, notes, and snippets.

@abbot
Created February 13, 2012 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abbot/1819970 to your computer and use it in GitHub Desktop.
Save abbot/1819970 to your computer and use it in GitHub Desktop.
datefmt=%s example for python logging
[loggers]
keys = root
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = INFO
handlers = console
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %s
$ python test.py
1329165116 CRITI [root] hello, world!
import logging.config
logging.config.fileConfig("conf.ini")
logging.fatal("hello, world!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment