#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
------------------------------+------------------------------------
     Reporter:  direx         |                    Owner:  nobody
         Type:  Bug           |                   Status:  new
    Component:  Core (Other)  |                  Version:  2.0
     Severity:  Normal        |               Resolution:
     Keywords:                |             Triage Stage:  Accepted
    Has patch:  0             |      Needs documentation:  0
  Needs tests:  0             |  Patch needs improvement:  0
Easy pickings:  0             |                    UI/UX:  0
------------------------------+------------------------------------

Comment (by direx):

 Just for the record: A custom SocketHandler which works around this
 problem could look like this:

 {{{
 # -*- coding: utf-8 -*-
 from logging.handlers import SocketHandler as _SocketHandler

 class DjangoSocketHandler(_SocketHandler):
     def emit(self, record):
         if hasattr(record, 'request'):
             record.request = None
         return super().emit(record)
 }}}

 I don't know if you guys want to ship this as a workaround and update the
 documentation accordingly. This could also be a ''documentation-only'' fix
 where this code is added as an example for socket logging.

 On the other hand an actual fix would be nice of course. I know this is
 not an easy task and since the majority of people probably won't be using
 socket logging, a documented and supported workaround (such as the code
 above) might be sufficient.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29186#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.641973abd7083f04df6202c0ea6a3e35%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to