Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to log requests to stdout in Tornado web server?

Tags:

tornado

I'm starting to develop a simple Tornado application, and I'd like to see request log in stdout while I develop. Currently I only see 404 warning messages.

Is there a way to have all requests printed in stdout?

like image 554
lfagundes Avatar asked Nov 28 '11 13:11

lfagundes


2 Answers

You can add this to you application:

from tornado.log import enable_pretty_logging
enable_pretty_logging()

By default it writes logs to stdout.

like image 98
Roman Shmatov Avatar answered Sep 21 '22 03:09

Roman Shmatov


Add this to your app:

import tornado.options
tornado.options.parse_command_line()

The parse_command_line function sets up logging. You can then pass --logging=loglevel (e.g. debug)

like image 27
Cole Maclean Avatar answered Sep 18 '22 03:09

Cole Maclean