Skip to content

Instantly share code, notes, and snippets.

@blalab
Last active March 13, 2017 23:24
Show Gist options
  • Save blalab/d8ccd9c83f025197fac8c2a2d680c58e to your computer and use it in GitHub Desktop.
Save blalab/d8ccd9c83f025197fac8c2a2d680c58e to your computer and use it in GitHub Desktop.
Logging config for Flask + Tornado
{
"version": 1,
"disable_existing_loggers": false,
"formatters": {
"simple": {
"format": "%(asctime)s - %(levelname)s - %(module)s - %(message)s"
},
"debug": {
"format": "%(asctime)s - %(levelname)s - %(pathname)s:%(lineno)s:%(funcName)s - %(message)s"
}
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"level": "DEBUG",
"formatter": "debug",
"stream": "ext://sys.stdout"
},
"debug_file_handler": {
"class": "logging.handlers.RotatingFileHandler",
"level": "DEBUG",
"formatter": "debug",
"filename": "debug.log",
"maxBytes": 10485760,
"backupCount": 20,
"encoding": "utf8"
},
"info_file_handler": {
"class": "logging.handlers.RotatingFileHandler",
"level": "INFO",
"formatter": "simple",
"filename": "info.log",
"maxBytes": 10485760,
"backupCount": 20,
"encoding": "utf8"
},
"error_file_handler": {
"class": "logging.handlers.RotatingFileHandler",
"level": "ERROR",
"formatter": "simple",
"filename": "error.log",
"maxBytes": 10485760,
"backupCount": 20,
"encoding": "utf8"
}
},
"loggers": {
"root": {
"level": "DEBUG",
"handlers": ["console","debug_file_handler", "info_file_handler", "error_file_handler"],
"propagate": false
},
"tornado.general": {
"level": "INFO",
"handlers": ["console", "info_file_handler"],
"propagate": false
}
},
"root": {
"level": "INFO",
"handlers": []
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment