添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

I am using Tornado, and in my app I import logging so I can log some information about the server.

I put this:

logging.config.dictConfig(web_LOGGING)

right before:

tornado.options.parse_command_line()

but when I run the server and click any link I get the following error:

Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/__init__.py", line 874, in emit
    stream.write(fs % msg)
AttributeError: 'str' object has no attribute 'write'
Logged from file web.py, line 1946

What is causing this?

I've already changed to another directory to steer clear of namespace conflicts.

What is the definition of web_LOGGING? My answer is a likely problem, but you need to provide enough information to reproduce; knowing you used dictConfig is not super helpful when we don't know the configuration passed. – ShadowRanger Sep 7 '16 at 5:19 in handlers i put "stream":"ext"#sys.stdout,i intend to put any info to sys.stdout.while for warning,i want to log into a file,like 'filename': './web_log/rotated.log'..so something wrong with stream here? – simonchou Sep 7 '16 at 5:24 "stream": "ext" would definitely be wrong, while "stream": sys.stdout should be fine. Not sure what you mean by "stream":"ext"#sys.stdout – ShadowRanger Sep 7 '16 at 10:07 Improve this answer Follow