#32016: ValueError: Unable to configure handler 'mail_admins' on custom logging configuration -------------------------------------+------------------------------------- Reporter: Susana | Owner: (none) Cárdenas Molinar | Type: Bug | Status: new Component: Error | Version: 3.1 reporting | Severity: Normal | Keywords: settings, logging Triage Stage: | Has patch: 0 Unreviewed | Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -------------------------------------+------------------------------------- When upgrading to Django 3.1, the following error appears when trying to start the application on Docker:
`ValueError: Unable to configure handler 'mail_admins'`. The `mail_admins` section of the configuration is the same as the [https://docs.djangoproject.com/en/3.1/topics/logging/#django.utils.log.AdminEmailHandler examples] shown in the documentation. This same code is working fine in Django 3.0 and when the `mail_admins` key is commented or deleted from the configuration, everything works properly. This is some of the code contained in the base settings file: {{{ DJANGO_EMAIL_ADMINS_BACKEND = os.environ.get( "DJANGO_EMAIL_ADMINS_BACKEND", "django.core.mail.backends.console.EmailBackend" ) LOGGING_CONFIG = None logging.config.dictConfig( { "version": 1, "disable_existing_loggers": False, "filters": { "require_debug_false": {"()": "django.utils.log.RequireDebugFalse"}, "require_debug_true": {"()": "django.utils.log.RequireDebugTrue"}, }, "formatters": { "django.server": { "()": "django.utils.log.ServerFormatter", "format": "[%(server_time)s] %(message)s", } }, "handlers": { "nodebug_console": { "level": "WARNING", "filters": ["require_debug_false"], "class": "logging.StreamHandler", }, "debug_console": { "level": "INFO", "filters": ["require_debug_true"], "class": "logging.StreamHandler", }, "django.server": { "level": "INFO", "class": "logging.StreamHandler", "formatter": "django.server", }, "mail_admins": { "level": "ERROR", "filters": ["require_debug_false"], "class": "django.utils.log.AdminEmailHandler", "email_backend": DJANGO_EMAIL_ADMINS_BACKEND, }, }, "loggers": { "django": { "handlers": ["nodebug_console", "debug_console", "mail_admins"], "level": os.environ.get("DJANGO_LOG_LEVEL", "INFO"), }, "django.server": { "handlers": ["django.server"], "level": os.environ.get("DJANGO_LOG_LEVEL", "INFO"), "propagate": False, }, "Wikilink": { "handlers": ["nodebug_console", "debug_console", "mail_admins"], "level": os.environ.get("DJANGO_LOG_LEVEL", "INFO"), }, }, } ) }}} -- Ticket URL: <https://code.djangoproject.com/ticket/32016> 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 django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/052.545eb54e400c6ff0dff22f07967e43d7%40djangoproject.com.