paisley
paisley copied to clipboard
Replace python logger with twisted log
Python logging uses blocking APIs. Hence it must not be used in twisted code. A blocking log message can block the entire twisted event loop.
Refer to: http://twistedmatrix.com/documents/10.2.0/core/howto/logging.html#auto3
Although there is a twisted observer for this, it is still a blocking API. It is not a good practice to use it. (if somebody configures a db based log, it will block).
I don't think it's a bad idea to swap in the Twisted logger. That said the Twisted logger also blocks unless you're using the syslog observer. I made an attempt at fixing this in Twisted but got bogged down in the inane review process. If Sean is alright with this direction I'd advocate integrating it. His call though since he's working on the logging refactor.
Twisted logging looks good, will merge once I get a chance to make some of the new log lines grepable with prefixes.