[英]How to get django runserver to stop logging to console in pycharm
here is my are my logger settings 这是我的记录器设置
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
# Send all messages to console
'console': {
'level': 'INFO',
'class': 'logging.StreamHandler',
'formatter': 'verbose',
},
},
'loggers': {
'': {
'handlers': ['console'],
'level': 'INFO',
'propagate': True,
},
},
}
I have configured logging in Django, but my logs are drowned in the continous GET, POST, PUT requests my frontend generates ie i dont want to see logs from django like this 我已经在Django中配置了日志记录,但我的日志被淹没在连续的GET,POST,PUT请求我的前端生成,即我不想看到来自django的日志,就像这样
[08/Jul/2015 11:05:59] "GET /home/ HTTP/1.1" 200 910
only my logs from 只有我的日志来自
logger = logging.getLogger(__name__)
logger.info('Hello world')
is there a way to letrunserver not to display requests and only show logs only from my loggers 有没有办法让letrunserver不显示请求,只显示记录器中的日志
I forgot to mention this in in pycharm 我忘了在pycharm中提到这个
this has no effect in additional options 这对其他选项没有影响
--verbosity 0
this in additional options 这还有其他选择
> dev/null
gives this error 给出了这个错误
CommandError: Usage is runserver [optional port number, or ipaddr:port]
Process finished with exit code 1
You can use Logging settings to do that. 您可以使用日志记录设置来执行此操作。
Django has number of default Loggers , you can change the handler for whatever logger you want. Django有许多默认记录器 ,您可以更改所需记录器的处理程序。 Maybe if you want to stop it forever make it
'handlers': ['null']
. 也许如果你想永远阻止它,那就让它成为
'handlers': ['null']
。
Reading documentation would be very helpful for you for more information about managing your log. 阅读文档对于您有关管理日志的更多信息非常有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.