【问题标题】:How can I get tornado to print out the datetime when logging INFO?记录 INFO 时如何让龙卷风打印出日期时间?
【发布时间】:2018-07-10 16:59:13
【问题描述】:

我正在使用 enable_pretty_logging 选项。似乎应该有一种方法可以将其配置为将日期时间与日志一起打印出来,但现在看起来像这样

INFO:tornado.access:200 GET /?asg_names=asg_name (10.10.163.112) 1475.84ms

有没有办法让它也打印出日期时间?

【问题讨论】:

    标签: python tornado


    【解决方案1】:

    这不是enable_pretty_logging 使用的格式;这是 python 日志模块使用的默认 logging.basicConfig 格式。 Tornado 只有在没有其他东西事先触及日志配置的情况下才会默认启用“漂亮”的日志记录。尝试在启动过程的早期插入对tornado.log.enable_pretty_logging() 的调用,在其他任何东西有机会使用日志之前。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多