django logging
Posted zhengze
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了django logging相关的知识,希望对你有一定的参考价值。
LOG_LEVEL = ‘DEBUG‘
LOGGING = {
‘version‘ : 1,
‘disable_existing_loggers‘ : True,
‘formatters‘ : {
‘standard‘ : {
‘format‘ : ‘%(asctime)s [%(threadName)s:%(thread)d] [%(name)s:%(lineno)d] z [%(levelname)s]- %(message)s‘
},
‘verbose‘ : {
‘format‘ : ‘[%(asctime)s] %(levelname)-6s %(name)s %(lineno)d %(threadName)s:%(thread)d %(message)s‘
},
},
‘filters‘: {
},
‘handlers‘: {
‘torstatus‘: {
‘level‘: LOG_LEVEL,
‘class‘: ‘logging.handlers.RotatingFileHandler‘,
‘filename‘: os.path.join(BASE_DIR ,‘logs/torstatus.log‘),
‘maxBytes‘: 1024*1024*5, # 5 MB
‘backupCount‘: 5,
‘formatter‘: ‘verbose‘,
},
},
‘loggers‘: {
‘torstatus‘: {
‘handlers‘: [‘torstatus‘],
‘level‘: LOG_LEVEL,
‘propagate‘: False
},
}
}
以上是关于django logging的主要内容,如果未能解决你的问题,请参考以下文章