version: 1
disable_existing_loggers: no  # 是否覆蓋以前的配置logger
formatters:
        simple:
            format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
 
root: #默認情況下配置
    level: INFO
    handlers: [console,info_file_handler,error_file_handler]
 
loggers: #如果有設定loggers的話會採用，否則採用root設定
    my_module1:
            level: INFO
            handlers: [console,info_file_handler]
            propagate: no
    my_module2:
            level: INFO
            handlers: [console,info_file_handler]
            propagate: no
 
handlers:
    console:
            class: logging.StreamHandler
            level: DEBUG
            formatter: simple
            stream: ext://sys.stdout
    info_file_handler:
            class: logging.handlers.RotatingFileHandler
            level: INFO
            formatter: simple
            filename: /var/www/ntcri_api/app/info.log
            maxBytes: 5242880
            backupCount: 1
            encoding: utf8
    error_file_handler:
            class: logging.handlers.RotatingFileHandler
            level: ERROR
            formatter: simple
            filename: /var/www/ntcri_api/app/error.log
            maxBytes: 5242880
            backupCount: 1
            encoding: utf8