Search code examples
python-2.7loggingtornadoattributeerrorsetattribute

AttributeError in Python Tornado to configure log into a file


when I try to configure my Python Tornado Web Server to log into a file, I always get an AttributeError: 'NoneType' object has no attribute 'set' exception.

Below the code I'm using to do this:

tornado.options.options["log_file_prefix"].set("local.log")

I tried to go through documentation and some example from internet, but I didn't find anything.

I'm using tornado 4.2.1 with Python 2.7.9.

Do you have any suggestions?

Thanks in advance.


Solution

  • Use attribute assignment syntax:

    tornado.options.options.log_file_prefix = "local.log"