logging level
Level | Numeric value |
---|---|
CRITICAL | 50 |
ERROR | 40 |
WARNING | 30 |
INFO | 20 |
DEBUG | 10 |
NOTSET | 0 |
value 值越大等级越高
logging config
version: 1
loggers:
root:
level: DEBUG
handlers: [console]
tornado:
level: DEBUG
handlers: [console,log]
propagate: no
tornado.access:
level: DEBUG
handlers: [console, access]
propagate: no
log:
level: DEBUG
handlers: [console,log]
propagate: no
formatters:
simple:
format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
timedRotating:
format: '%(asctime)s %(name)-12s %(levelname)-8s - %(message)s'
handlers:
console:
class: logging.StreamHandler
level: DEBUG
formatter: simple
access:
class: logging.handlers.TimedRotatingFileHandler
level: DEBUG
formatter: simple
filename: 'logs/access.log'
when: 'midnight'
interval: 1
backupCount: 180
log:
class: logging.handlers.TimedRotatingFileHandler
level: DEBUG
formatter: timedRotating
filename: 'logs/log.log'
when: 'midnight'
interval: 1
backupCount: 180
encoding: 'utf8'