Skip to content

Instantly share code, notes, and snippets.

@kevenli
Created November 2, 2018 01:38
Show Gist options
  • Save kevenli/24640b5fe993538ffe833e466a093af8 to your computer and use it in GitHub Desktop.
Save kevenli/24640b5fe993538ffe833e466a093af8 to your computer and use it in GitHub Desktop.
python logging conf file
[loggers]
keys=root,access
[handlers]
keys=consoleHandler,errorFileHandler,accessFileHandler,infoFileHandler
[formatters]
keys=simpleFormatter, accessFormatter
[logger_root]
level=INFO
handlers=consoleHandler,errorFileHandler,infoFileHandler
[logger_access]
level=INFO
handlers=accessFileHandler
qualname=tornado.access
propagate=0
[handler_consoleHandler]
class=StreamHandler
level=DEBUG
formatter=simpleFormatter
args=(sys.stdout,)
[handler_errorFileHandler]
class=handlers.TimedRotatingFileHandler
level=ERROR
formatter=simpleFormatter
args=('log/error.log','midnight')
[handler_accessFileHandler]
class=handlers.TimedRotatingFileHandler
level=INFO
formatter=accessFormatter
args=('log/access.log','midnight')
[handler_infoFileHandler]
class=handlers.TimedRotatingFileHandler
level=INFO
formatter=simpleFormatter
args=('log/info.log','midnight')
[formatter_simpleFormatter]
format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
datefmt=
[formatter_accessFormatter]
format=%(asctime)s - %(message)s
datefmt=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment