In a python project with multiple threads my logging works well to write to a logger file. Basically based on Logging, StreamHandler and standard streams
Part of my project is a bottle web server which runs well also. But every bottle call writes a log to the console like this:
192.168.178.20 - - [26/Jun/2015 20:22:17] "GET /edit?addJob HTTP/1.1" 200 48028
How to handle this the same way as with the other code, so the bottle logs go also to the logger file?
If you're rolling your own solution, you should write a simple Bottle plugin that emits log lines to a
logging
logger. Here's an example that sets up a basic logger, defines the logging plugin, and creates a Bottle app with that plugin installed on all routes.Running that code yields what you want: