Reputation: 348
I am using Tornado for a websockets server and I am trying to figure out how to log to a file without blocking the main thread. Is tornado.log non-blocking? If not, is there a general pythonic way to log to a file without blocking the main thread?
Thanks!
Upvotes: 1
Views: 532
Reputation: 22154
Tornado uses the standard library's logging
module, which is blocking in most configurations. Python 3.2 includes a QueueHandler
class which can be used to move the actual I/O to a separate thread; prior to that there was no standard solution to non-blocking logging (but there's probably a package on PyPI with a 2.x-compatible implementation).
Upvotes: 1