I assign a unique identifier to each incoming request and want it to be automatically included in the logs when logging is performed (without explicitly including it in all places). I use middleware to create and store this unique identifier in a local thread.
I want to change the Django logging format to include this unique identifier directly:
LOGGING = { ... 'formatters': { 'full': { 'format': '%(asctime)s %(levelname)s %(name)s - %(message)s', } } ... }
How to add a unique id component to the formatter without explicitly adding it to each log statement?
source share