|Logging?||Joseph Turian||9/14/09 7:07 PM|
What is the simplest way to log messages to stderr or stdout?
I tried print, as well as the python logging module, but I don't see
the messages show up anywhere.
|Re: Logging?||Rolando Espinoza La fuente||9/14/09 7:52 PM|
Hi, i had this problem too and discovered that need to run parse_command_line()
Here is an example:
# this line will setup default logging no matter if you use command options
http_server = tornado.httpserver.HTTPServer(application)
|Re: Logging?||Bret Taylor||9/14/09 7:56 PM|
Tornado uses the Python logging facility by default. As Rolando
mentioned, we turn on "pretty printing" for log messages when you use
the Tornado options module, but you don't actually have to. If you
just ran logging.getLogger().setLevel(logging.INFO) at the beginning
of your program and then used logging.info("...") for messages, you
would see them print to stdout. Our options module color codes the
output and does a few other useful things for interactive debugging.
If you use the Tornado options module, you can set the log level with
--logging=info / --logging=debug / --logging=warning, etc.
On Sep 14, 7:52 pm, Rolando Espinoza La Fuente <dark...@gmail.com>
|Re: Logging?||Joseph Turian||9/14/09 10:43 PM|
Thank you for the information, Rolando + Bret.
This definitely belongs in the wiki-like documentation, once you get
that set up.
|Re: Logging?||Attila Babo||9/16/09 3:38 PM|
Let me suggest to separate logging setup and
tornado.options.parse_command_line(). Logging to a file is a common
need, I've tried to use a command line option to specify a logfile and
set up my own logging but failed utterly because of the unwanted side
effect of parse_command_line.
|Re: Logging?||Ralf Schmitt||9/16/09 4:48 PM|
On Tue, Sep 15, 2009 at 4:52 AM, Rolando Espinoza La Fuente
If someone wonders why they do not get log output, it could be cause
|Re: Logging?||Bret Taylor||9/17/09 9:04 AM|
We don't have any special logging facilities in Tornado - we use
Python's built-in logging module: http://docs.python.org/library/logging.html.
It in no way depends on our options module. The only thing our options
module does is introduce the ability to change the log level through
command line options (--logging=warning, etc), and it color codes the
log output in an interactive console.
We will update the docs to explain logging, but I wanted to make sure
it is clear that Tornado logging is not anything special nor is it
dependent on any Tornado module.
|Re: Logging?||ben||9/17/09 9:46 AM|