[go: up one dir, main page]

0% found this document useful (0 votes)
9 views2 pages

Logging Custom Test

The document outlines a logging configuration for a Python application using the logging module. It specifies various log handlers for different log levels (DEBUG, INFO, ERROR, CRITICAL, WARN) with settings for file rotation and formatting. The root logger is set to NOTSET level, while specific modules have their own logging levels and handlers defined.

Uploaded by

latiy81565
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

Logging Custom Test

The document outlines a logging configuration for a Python application using the logging module. It specifies various log handlers for different log levels (DEBUG, INFO, ERROR, CRITICAL, WARN) with settings for file rotation and formatting. The root logger is set to NOTSET level, while specific modules have their own logging levels and handlers defined.

Uploaded by

latiy81565
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

version: 1

disable_existing_loggers: False

formatters:
standard:
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
error:
format: "%(levelname)s <PID %(process)d:%(processName)s> %(name)s.%
(funcName)s(): %(message)s"

handlers:
console:
class: logging.StreamHandler
level: DEBUG
formatter: standard
stream: ext://sys.stdout

info_file_handler:
class: logging.handlers.RotatingFileHandler
level: INFO
formatter: standard
filename: /tmp/info.log
maxBytes: 10485760 # 10MB
backupCount: 20
encoding: utf8

error_file_handler:
class: logging.handlers.RotatingFileHandler
level: ERROR
formatter: error
filename: /tmp/errors.log
maxBytes: 10485760 # 10MB
backupCount: 20
encoding: utf8

debug_file_handler:
class: logging.handlers.RotatingFileHandler
level: DEBUG
formatter: standard
filename: /tmp/debug.log
maxBytes: 10485760 # 10MB
backupCount: 20
encoding: utf8

critical_file_handler:
class: logging.handlers.RotatingFileHandler
level: CRITICAL
formatter: standard
filename: /tmp/critical.log
maxBytes: 10485760 # 10MB
backupCount: 20
encoding: utf8

warn_file_handler:
class: logging.handlers.RotatingFileHandler
level: WARN
formatter: standard
filename: /tmp/warn.log
maxBytes: 10485760 # 10MB
backupCount: 20
encoding: utf8

root:
level: NOTSET
handlers: [console]
propogate: yes

loggers:
<module>:
level: INFO
handlers: [console, info_file_handler, error_file_handler,
critical_file_handler, debug_file_handler, warn_file_handler]
propogate: no

<module.x>:
level: DEBUG
handlers: [info_file_handler, error_file_handler, critical_file_handler,
debug_file_handler, warn_file_handler]
propogate: yes

You might also like