dimanche 28 juin 2015

How to add request id in Django logs without modifying logger call?

I want to add request and user ids with logs of my Django project. Ways I found on internet need me to send extra request with every logger call like this,

logger.info('This is my info log line', extras={ 'request', request })

But I don't want to modify every existing logger call. Is it possible to this with handlers/formatters?

Aucun commentaire:

Enregistrer un commentaire