Discuss / Python / 通过logging输出的aiohttp的access日志的时区不对

通过logging输出的aiohttp的access日志的时区不对

Topic source
INFO:root:server started at http://127.0.0.1:9000...
INFO:aiohttp.access:127.0.0.1 - - [11/May/2016:02:42:34 +0000] "GET / HTTP/1.1" 200 16 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0"

这是10点42分的访问日志,输出时间差了8个小时。

google了一上午都没找到解决办法。

我猜应该是要在app.make_handler()中传入个什么参数。

我试过传入access_log=None,logging输出的信息就只有logging.info()中自定义的信息

INFO:root:server started at http://127.0.0.1:9000...

aiohttp.access信息就不会出现了。所以我猜应该是要在app.make_handler()中传入个什么参数才能保证输出时间为本地的时间,但具体什么参数查了一上午都没查到,好蛋疼啊。

廖雪峰

#2 Created at ... [Delete] [Delete and Lock User]

logging按服务器时区输出,你的服务器配置是GMT+0不是+8


  • 1

Reply