Skip to content

Instantly share code, notes, and snippets.

@pollenjp
Last active June 10, 2020 17:05
Show Gist options
  • Save pollenjp/6f814ded2c9bf5b5fd44acb152d845b1 to your computer and use it in GitHub Desktop.
Save pollenjp/6f814ded2c9bf5b5fd44acb152d845b1 to your computer and use it in GitHub Desktop.
logging.conf.yml サンプル
# https://docs.python.org/3/library/logging.config.html#configuration-dictionary-schema
version: 1
formatters:
console_formatter:
# https://docs.python.org/ja/3/howto/logging.html#logging.logging.Formatter.__init__
format: "%(asctime)s | %(name)20s | %(levelname)10s | %(threadName)8s | %(filename)20s:%(lineno)4d | %(message)s"
file_formatter:
format: "%(asctime)s | %(name)20s | %(levelname)10s | %(threadName)8s | %(filename)20s:%(lineno)4d | %(message)s"
handlers:
console_handler:
class: logging.StreamHandler
level: INFO
formatter: console_formatter
file_handler:
class: logging.handlers.RotatingFileHandler
filename: "app.log"
mode: "a"
maxBytes: 52428800 # 50 * 1024 * 1024
backupCount: 100
encoding: "utf-8"
level: DEBUG
formatter: file_formatter
# loggers:
root:
level: DEBUG
handlers:
- console_handler
- file_handler
disable_existing_loggers: False # https://qiita.com/propella/items/5ad25eca11de2a871a06
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment