如何在wsgi应用程序中设置日志级别
mod_wsgi-express ./mywsgi.py?这是最简单的设置。wsgi应用程序和快速配置指南一样谈论配置文件。mod_wsgi-express命令只需要python文件来操作。
使用--log-level标志,如发布说明中所述
mod_wsgi-express --log-level info ./mywsgi.py没有显示logging.info消息。--debug-mode标志@GrahamDumpleton也没有。
已解决(见下文),但仍然是:最小的例子
import logging
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
def application(environ, start_response):
status = '200 OK'
logging.warning('warning log message')
logging.info('info log message')
output = "hello world"
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]发布于 2016-04-12 10:16:29
您还需要启用INFO (f.ex)(参见上面的示例)。wsgi程序中的级别日志记录。例如,通过行
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)如果然后从--log-level info开始,您将在error_log中看到logging.info输出。
https://stackoverflow.com/questions/36567372
复制相似问题