#27271: ServerFormatter should handle simple string messages with or without 
args
---------------------------------+-----------------------------------------
     Reporter:  Sergey Fursov    |                    Owner:  Sergey Fursov
         Type:  Bug              |                   Status:  assigned
    Component:  Utilities        |                  Version:  1.10
     Severity:  Release blocker  |               Resolution:
     Keywords:                   |             Triage Stage:  Accepted
    Has patch:  1                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+-----------------------------------------
Changes (by Tim Graham):

 * severity:  Normal => Release blocker
 * stage:  Unreviewed => Accepted


Old description:

> In our selenium tests we see next error:
> {{{
> Traceback (most recent call last):
>   File "/usr/local/lib/python2.7/logging/__init__.py", line 853, in emit
>     msg = self.format(record)
>   File "/usr/local/lib/python2.7/logging/__init__.py", line 726, in
> format
>     return fmt.format(record)
>   File "/usr/local/lib/python2.7/site-packages/django/utils/log.py", line
> 173, in format
>     if args[1][0] == '2':
> IndexError: tuple index out of range
> Logged from file basehttp.py, line 85
> }}}
>
> basehttp.py module on line 85 logs info message about Broken pipe error
> as
> {{{
> logger.info("- Broken pipe from %s\n", client_address)
> }}}
>
> but ServerFormatter can't handle simple log messages with formatting
> args. Also, with default logging configuration ServerFormatter can't
> process records without server_time variable. Both cases can be easily
> reproduced by next code:
> {{{
> import logging
> logger = logging.getLogger('django.server')
> logger.info('some message with arg: %s', 'arg value')
> logger.info('some message')
> }}}
>
> Bug was introduced in https://code.djangoproject.com/ticket/25684

New description:

 In our selenium tests we see next error:
 {{{
 Traceback (most recent call last):
   File "/usr/local/lib/python2.7/logging/__init__.py", line 853, in emit
     msg = self.format(record)
   File "/usr/local/lib/python2.7/logging/__init__.py", line 726, in format
     return fmt.format(record)
   File "/usr/local/lib/python2.7/site-packages/django/utils/log.py", line
 173, in format
     if args[1][0] == '2':
 IndexError: tuple index out of range
 Logged from file basehttp.py, line 85
 }}}

 basehttp.py module on line 85 logs info message about Broken pipe error as
 {{{
 logger.info("- Broken pipe from %s\n", client_address)
 }}}

 but ServerFormatter can't handle simple log messages with formatting args.
 Also, with default logging configuration ServerFormatter can't process
 records without server_time variable. Both cases can be easily reproduced
 by next code:
 {{{
 import logging
 logger = logging.getLogger('django.server')
 logger.info('some message with arg: %s', 'arg value')
 logger.info('some message')
 }}}

 Bug was introduced in #25684.

--

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

Reply via email to