我在哪里可以查看 tornado 的日志文件? [英] Where can I check tornado's log file?

查看:45
本文介绍了我在哪里可以查看 tornado 的日志文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为有一个默认的日志文件,但我还没有找到.

I think there was a default log file, but I didn't find it yet.

有时 HTTP 请求过程会在屏幕上抛出异常,但我建议它也会出现在磁盘上的某个地方,否则在长时间运行的测试中我不知道出了什么问题.

Sometimes the HTTP request process would throw an exception on the screen, but I suggest it also goes somewhere on the disk or I wouldn't know what was wrong during a long run test.

P.S.:编写异常处理程序是另一个话题;首先我想知道我的问题的答案.

P.S.: write an exception handler is another topic; first I'd like to know my question's answer.

我在这里找到了一些东西:https://groups.google.com/forum/?fromgroups=#!topic/python-tornado/px4R8Tkfa9c

I found something here: https://groups.google.com/forum/?fromgroups=#!topic/python-tornado/px4R8Tkfa9c

但它也没有提到我在哪里可以找到这些日志.

But it also didn't mention where can I find those log.

推荐答案

默认使用标准的 python 日志模块.

It uses standard python logging module by default.

这是定义:

access_log = logging.getLogger("tornado.access")
app_log = logging.getLogger("tornado.application")
gen_log = logging.getLogger("tornado.general")

默认情况下它不会写入文件.您可以使用 supervisord 运行它,并在 supervisord 配置中定义日志文件所在的位置.它将捕获龙卷风的输出并将其写入文件.

It doesn't write to files by default. You can run it using supervisord and define in supervisord config, where log files will be located. It will capture output of tornado and write it to files.

你也可以这样想这种方式:

tornado.options.options['log_file_prefix'].set('/opt/logs/my_app.log')
tornado.options.parse_command_line()

但在这种情况下 - 衡量性能.如果可以委托,我不建议您直接从 Tornado 应用程序写入文件.

But in this case - measure performance. I don't suggest you to write to files directly from tornado application, if it can be delegated.

仅供参考:parse_command_line 只启用漂亮的控制台日志.

这篇关于我在哪里可以查看 tornado 的日志文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆