Skip to content

Instantly share code, notes, and snippets.

@webghostx
Forked from gistsobo/log.conf
Last active January 28, 2017 16:11
Show Gist options
  • Save webghostx/4743a955d72ab61c10e05e5f096e4dfb to your computer and use it in GitHub Desktop.
Save webghostx/4743a955d72ab61c10e05e5f096e4dfb to your computer and use it in GitHub Desktop.
Python: json logger config
{
"version": 1,
"disable_existing_loggers": false,
"formatters": {
"simple": {
"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
},
"brief": {
"format": "%(levelname)-9s: %(name)-11s: %(message)s"
},
"precise": {
"format": "%(asctime)-26s %(name)-11s %(levelname)-9s %(message)s"
}
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"level": "INFO",
"formatter": "simple",
"stream": "ext://sys.stdout"
},
"file": {
"class": "logging.handlers.RotatingFileHandler",
"formatter": "precise",
"filename": "app.log",
"maxBytes": 100000,
"backupCount": 2
}
},
"loggers": {
"Main": {
"level": "DEBUG",
"handlers": ["console", "file"],
"propagate": 0
}
},
"root": {
"level": "DEBUG",
"handlers": ["console", "file"]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment