log_config.yaml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. version: 1
  2. disable_existing_loggers: no # 是否覆蓋以前的配置logger
  3. formatters:
  4. simple:
  5. format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
  6. root: #默認情況下配置
  7. level: INFO
  8. handlers: [console,info_file_handler,error_file_handler]
  9. loggers: #如果有設定loggers的話會採用,否則採用root設定
  10. my_module1:
  11. level: INFO
  12. handlers: [console,info_file_handler]
  13. propagate: no
  14. my_module2:
  15. level: INFO
  16. handlers: [console,info_file_handler]
  17. propagate: no
  18. handlers:
  19. console:
  20. class: logging.StreamHandler
  21. level: DEBUG
  22. formatter: simple
  23. stream: ext://sys.stdout
  24. info_file_handler:
  25. class: logging.handlers.RotatingFileHandler
  26. level: INFO
  27. formatter: simple
  28. filename: /var/www/ntcri_api/app/info.log
  29. maxBytes: 5242880
  30. backupCount: 1
  31. encoding: utf8
  32. error_file_handler:
  33. class: logging.handlers.RotatingFileHandler
  34. level: ERROR
  35. formatter: simple
  36. filename: /var/www/ntcri_api/app/error.log
  37. maxBytes: 5242880
  38. backupCount: 1
  39. encoding: utf8