Skip to content

Instantly share code, notes, and snippets.

@gistsobo
Created January 10, 2013 12:49
Show Gist options
  • Save gistsobo/4501834 to your computer and use it in GitHub Desktop.
Save gistsobo/4501834 to your computer and use it in GitHub Desktop.
Python: json logger config
{
"version": 1,
"formatters":
{
"simple":
{
"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
},
"brief":
{
"format": "%(levelname)-8s: %(name)-15s: %(message)s"
},
"precise":
{
"format": "%(asctime)s %(name)-15s %(levelname)-8s %(message)s"
}
},
"handlers":
{
"console":
{
"class": "logging.StreamHandler",
"level": "DEBUG",
"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": "WARN",
"handlers": ["console"]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment