How can I stop sys.stdout logging to apache error file?

孤街醉人 提交于 2019-12-14 02:50:05

问题


I have the Python logging library set up to log everything to my console handler. This works great in development so I can see my log messages without having to look through the files but in production all of the logs are being written to the apache error file.

Is this desired behaviour? Shouldn't stderr solely write to the error file?

The console handler set up in my yaml config file:

handlers:
  console:
    class: logging.StreamHandler
    formatter: precise
    filters: [request_id]
    stream: ext://sys.stdout

I have thought about only adding the console handler in debug mode, but I have lots of loggers with propagate set to false, so I would have to add the handler to each logger which defeats the point of my config file.

I have put the entire config file into pastebin.

How can I stop stdout writing to the Apache error file and could this have adverse effects?

来源:https://stackoverflow.com/questions/36449922/how-can-i-stop-sys-stdout-logging-to-apache-error-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!