Created
February 13, 2012 20:32
-
-
Save abbot/1819970 to your computer and use it in GitHub Desktop.
datefmt=%s example for python logging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python test.py | |
1329165116 CRITI [root] hello, world! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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