An application I’m working on uses the logging module to log errors etc. In such a case it would be nice to be able to include the HTTP referer, GET/POST arguments etc. in the log entry.
While it would be possible to append it to the message before calling .error() etc, I’m looking for a way to do it at a central location (without wrapping those functions of course).
I now solved it using a custom formatter:
This formatter can be easily set using the
classoption in logging.conf (or via python code).