-
-
Save webghostx/4743a955d72ab61c10e05e5f096e4dfb to your computer and use it in GitHub Desktop.
Python: json logger config
This file contains hidden or 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
{ | |
"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