#25775: Method log_message in server.py uses sys.stderr.write, not logging
--------------------------------------+----------------------------------
     Reporter:  soar                  |      Owner:  nobody
         Type:  Cleanup/optimization  |     Status:  new
    Component:  HTTP handling         |    Version:  1.8
     Severity:  Normal                |   Keywords:  log, logging, stdout
 Triage Stage:  Unreviewed            |  Has patch:  0
Easy pickings:  0                     |      UI/UX:  0
--------------------------------------+----------------------------------
 I try to capture all log output of my Django-based project, but logged
 requests like:

 {{{
 [19/Nov/2015 12:30:12] "GET / HTTP/1.1" 200 12898
 [19/Nov/2015 12:37:32] "GET /favicon.ico HTTP/1.1" 302 0
 }}}

 can't be catched, reformatted, etc. I found line, where this log caused:

 {{{#!python
     def log_message(self, format, *args):
         """Log an arbitrary message.

         This is used by all other logging functions.  Override
         it if you have specific logging wishes.

         The first argument, FORMAT, is a format string for the
         message to be logged.  If the format string contains
         any % escapes requiring parameters, they should be
         specified as subsequent arguments (it's just like
         printf!).

         The client ip and current date/time are prefixed to
         every message.

         """

         sys.stderr.write("%s - - [%s] %s\n" %
                          (self.client_address[0],
                           self.log_date_time_string(),
                           format%args))
 }}}

 So, why you use `sys.stderr.write()`, not
 `logging.debug()/info()/warn()/etc`?

--
Ticket URL: <https://code.djangoproject.com/ticket/25775>
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/047.a2ac44856ff2104a9b652acd73b4e3a1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to