【发布时间】:2018-02-09 16:47:22
【问题描述】:
我现在看到
172.19.0.1 - - [09/Feb/2018:07:00:32 +0000] "GET /ping HTTP/1.1" 200 1 "-" "curl/7.47.0"
在我的日志中,但我使用structured logging like this。
我什至尝试过
ch = logging.StreamHandler()
ch.setFormatter(pythonjsonlogger.jsonlogger.JsonFormatter())
logging.getLogger("urllib3").addHandler(ch)
但我仍然看到这些消息。我有这样的 nginx/gunicorn (source):
nginx = subprocess.Popen(['nginx', '-c', '/opt/program/nginx.conf'])
gunicorn = subprocess.Popen(['gunicorn',
'--timeout', str(model_server_timeout),
'-k', 'gevent',
'-b', 'unix:/tmp/gunicorn.sock',
'-w', str(model_server_workers),
'server.wsgi:app'])
我猜这就是日志消息的来源。但我不知道如何在那里获得结构化日志记录。
【问题讨论】: