Skip to content

Instantly share code, notes, and snippets.

@kezabelle
Created January 14, 2015 11:22
Show Gist options
  • Save kezabelle/677eefa50897f647d300 to your computer and use it in GitHub Desktop.
Save kezabelle/677eefa50897f647d300 to your computer and use it in GitHub Desktop.
Django logging config at the project level. I'd have thought this would work, but instead it's a ValueError
# Logging config should be merged with the defaults in
# django.util.log.configure_logging() which is called
# by django.setup()
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'loggers': {}
}
for app in INSTALLED_APPS:
LOGGING['loggers'][app] = {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': False,
}
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/path/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/path/site-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/path/site-packages/django/__init__.py", line 20, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/path/site-packages/django/utils/log.py", line 87, in configure_logging
logging_config_func(logging_settings)
File "/path/logging/config.py", line 803, in dictConfig
dictConfigClass(config).configure()
File "/path/logging/config.py", line 636, in configure
'%r: %s' % (name, e))
ValueError: Unable to configure logger 'users': Unable to add handler 'mail_admins': 'mail_admins'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment