logging_config.yaml 943 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. version: 1
  2. disable_existing_loggers: False
  3. formatters:
  4. standard:
  5. format: "[%(asctime)s] [%(levelname)s] [%(name)s:%(lineno)d] - %(message)s"
  6. datefmt: "%Y-%m-%d %H:%M:%S"
  7. handlers:
  8. console:
  9. class: logging.StreamHandler
  10. level: INFO
  11. formatter: standard
  12. stream: ext://sys.stdout
  13. file:
  14. class: logging.handlers.RotatingFileHandler
  15. level: DEBUG
  16. formatter: standard
  17. filename: app/log/app.log # 相对路径,会被替换为绝对路径
  18. maxBytes: 10485760
  19. backupCount: 5
  20. encoding: utf8
  21. error_file:
  22. class: logging.handlers.RotatingFileHandler
  23. level: ERROR
  24. formatter: standard
  25. filename: app/log/errors.log # 相对路径,会被替换为绝对路径
  26. maxBytes: 10485760
  27. backupCount: 10
  28. encoding: utf8
  29. loggers:
  30. app:
  31. level: DEBUG
  32. handlers: [console, file, error_file]
  33. propagate: False
  34. root:
  35. level: DEBUG
  36. handlers: [console, file, error_file]