Reputation: 606
How do I enable any debug log with Tornado client?
For the server case you simply pass Debug=true to the Application constructor (see here). But what about the client?
From this doc, under "Client-side support", it seems like the correct, and only?, way to create a client is to invoke the websocket_connect method. Are there any different ways to create a client?
Here is what I tried:
Pass:
--logging=debug --log-file-prefix=/var/log/tlog
on the command line and use
tornado.options.parse_command_line()
A file called tlog is created but it's always empty.
Setting:
define("debug", True)
access_log = logging.getLogger("tornado.access")
access_log.setLevel(logging.DEBUG)
app_log = logging.getLogger("tornado.application")
app_log.setLevel(logging.DEBUG)
gen_log = logging.getLogger("tornado.general")
gen_log.setLevel(logging.DEBUG)
in my code.
(See this post for the specific problem I'm trying to debug and my current code)
Upvotes: 2
Views: 3158
Reputation: 22134
The Application(debug=True)
option doesn't have anything to do with debug logging. Logging is controlled by the --logging
flag (if you use parse_command_line()
), and --logging=debug
sets it to the most verbose level. There are simply very few logging lines in the client-side websocket code; if you're seeing empty log files then you're just not hitting any of them. You can verify this by adding calls to logging.debug()
to your own code after parse_command_line
.
Upvotes: 4