#23569: settings.LOGGING_CONFIG assumes dictConfig()
------------------------------+--------------------
     Reporter:  sethrh        |      Owner:  nobody
         Type:  Bug           |     Status:  new
    Component:  Core (Other)  |    Version:  1.7
     Severity:  Normal        |   Keywords:
 Triage Stage:  Unreviewed    |  Has patch:  1
Easy pickings:  0             |      UI/UX:  0
------------------------------+--------------------
 It seems that if you set the LOGGING_CONFIG settings var to fileConfig(),
 django breaks.

 It seems like the intention here is to create a set of default logging
 configurations, and then allow the user to override them. That seems like
 a good idea, except the DEFAULT_LOGGING variable is a dict, which is
 passed into the user-defined logging_config_func. So it seems like only
 dictConfig() is allowed.

 The trouble spot seems to be in django/utils/log.py:76:

 {{{
     if logging_config:
         # First find the logging configuration function ...
         logging_config_func = import_string(logging_config)

         logging_config_func(DEFAULT_LOGGING)

         # ... then invoke it with the logging settings
         if logging_settings:
             logging_config_func(logging_settings)
 }}}


 I think this should be something like:

 {{{
     if logging_config:
         # First find the logging configuration function ...
         logging_config_func = import_string(logging_config)

         dictConfig(DEFAULT_LOGGING)

         # ... then invoke it with the logging settings
         if logging_settings:
             logging_config_func(logging_settings)
 }}}



 In my case, I have defined

 {{{
 LOGGING_CONFIG = 'logging.config.fileConfig'
 LOGGING = '/path/to/ini_file'
 }}}

 Which results in an obscure ConfigParser.NoSectionError: No section:
 'formatters', as the fileConfig() is trying to use a ConfigParser to read
 a dictionary.

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

Reply via email to