Ticket #14861: logging-imports.diff

File logging-imports.diff, 1.3 KB (added by Adam Vandenberg, 14 years ago)
  • docs/topics/logging.txt

    diff --git a/docs/topics/logging.txt b/docs/topics/logging.txt
    index 845db20..37dabc8 100644
    a b This logging configuration does the following things:  
    349349          printed to the console; ``ERROR`` and ``CRITICAL``
    350350          messages will also be output via e-mail.
    351351
     352.. note::
     353    If your ``settings.py`` specifies a custom handler class, and the file
     354    defining that class also imports ``settings.py``, a circular import will
     355    occur.
     356
     357    So for example if ``settings.py`` contains the following config for
     358    ``LOGGING``::
     359
     360        LOGGING = {
     361          'version': 1,
     362          'handlers': {
     363            'custom_handler': {
     364              'level': 'INFO',
     365              'class': 'myproject.logconfig.MyHandler',
     366            }
     367          }
     368        }
     369
     370    and ``myproject/logconfig.py`` has the following line before the
     371    ``MyHandler`` definition::
     372
     373        from django.conf import settings
     374
     375    The dictconfig module spits out an exception like::
     376
     377        ValueError: Unable to configure handler 'custom_handler':
     378        Unable to configure handler 'custom_handler':
     379        'module' object has no attribute 'logconfig'
     380
    352381.. _formatter documentation: http://docs.python.org/library/logging.html#formatter-objects
    353382
    354383Custom logging configuration
Back to Top