Search code examples
pythonloggingtornado

How to make a log system for tornado


I've read the documentation: http://www.tornadoweb.org/en/stable/log.html

But I still don't know how to make a suitable log for my server, which is built with tornado.

For now, I need such a log system:
It can log everything with time format, and for each day it create a new log file.

It seems that TimedRotatingFileHandler is what I need but I don't know how to use it with tornado.


Solution

  • The Tornado logging streams are just standard loggers from the "logging" python module.

    There is nice tutorial on the python website https://docs.python.org/3/howto/logging.html#advanced-logging-tutorial

    As per how to set the handler (same tutorial) https://docs.python.org/3/howto/logging.html#handlers