本文介绍了为什么此日志记录配置无法打印到stdout?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
},
'simple': {
'format': '%(levelname)s %(message)s'
}
},
'handlers': {
'console': {
'level':'DEBUG',
'class':'logging.StreamHandler',
'strm': sys.stdout,
'formatter':'simple'
},
},
'loggers': {
'django': {
'handlers':['console'],
'propagate': True,
'level':'INFO',
},
#'django.request': {
# 'handlers': ['console'],
# 'level': 'ERROR',
# 'propagate': True,
#},
},
}
尝试了两种记录器,均处于活动状态,其中一个已注释掉(以及许多其他记录器).正在运行
Tried both out loggers, active and the one commented out (and many others).Running
python manage.py runserver 0.0.0.0:8080
但是在我的控制台上没有显示500错误的痕迹,只是:
And yet no strack trace on a 500 error printed my console, just:
[21/Feb/2012 04:21:10] "POST /some/path/function/ HTTP/1.1" 500 105627
我在做什么错了?
推荐答案
您需要指定过滤器
:
'loggers': {
'django': {
'handlers':['console'],
'filters': [], # <-- this line
'propagate': True,
'level':'INFO',
},
},
我不知道为什么.
这篇关于为什么此日志记录配置无法打印到stdout?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!