Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#23784 closed Cleanup/optimization (invalid)

Error reporting docs needs to state clearly that changing logging conf error emails are not sent out unless configuring it again

Reported by: Peter Lauri Owned by: Nathan Schagen
Component: Documentation Version: 1.7
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Related documentation: https://docs.djangoproject.com/en/1.7/howto/error-reporting/

It states To activate this behavior, put the email addresses of the recipients in the ADMINS setting. and in the following See also it states that this behavior can be customized by changing logging.

The problem here is that a novice user will not easily catch that they break this behavior if they add their own LOGGING into settings.py without also adding the AdminEmailHandler handler and corresponding logger.

Attachments (1)

0001-updated-error-reporting-documentation-as-per-ticket-.patch (978 bytes ) - added by Peter Novotnak 10 years ago.
documentation patch

Download all attachments as: .zip

Change History (12)

comment:1 by Collin Anderson, 10 years ago

Triage Stage: UnreviewedAccepted

I could see slightly improved wording being helpful, though it would be nice to not increase the amount of text too much.

comment:2 by Tim Graham, 10 years ago

Type: UncategorizedCleanup/optimization

comment:3 by Gabriel Muñumel, 10 years ago

Owner: changed from nobody to Gabriel Muñumel
Status: newassigned

by Peter Novotnak, 10 years ago

documentation patch

comment:4 by Peter Novotnak, 10 years ago

Does "0001-updated-error-reporting-documentation-as-per-ticket-.patch" work?

comment:5 by Peter Lauri, 10 years ago

Maybe include a direct link to the AdminEmailHandler as well as complement to the reference to the logging configuration?

https://docs.djangoproject.com/en/1.7/topics/logging/#django.utils.log.AdminEmailHandler

comment:6 by Gabriel Muñumel, 10 years ago

Owner: Gabriel Muñumel removed
Status: assignednew

comment:7 by Nathan Schagen, 10 years ago

Owner: set to Nathan Schagen
Status: newassigned

comment:9 by Nathan Schagen, 10 years ago

Has patch: unset
Resolution: invalid
Status: assignedclosed

According to django/conf/global_settings.py, LOGGING is an empty dictionary by default. There is also a DEFAULT_LOGGING in django/utils/log.py, which is where the default admin emailing behaviour is defined. DEFAULT_LOGGING and LOGGING are merged and therefore setting your own LOGGING conf does not break the email to admin feature.

I have tested this by installing a FileHandler in both DEFAULT_LOGGING and LOGGING and the message was written to both files.

in reply to:  9 comment:10 by Peter Lauri, 10 years ago

Replying to nschagen:

According to django/conf/global_settings.py, LOGGING is an empty dictionary by default. There is also a DEFAULT_LOGGING in django/utils/log.py, which is where the default admin emailing behaviour is defined. DEFAULT_LOGGING and LOGGING are merged and therefore setting your own LOGGING conf does not break the email to admin feature.

I have tested this by installing a FileHandler in both DEFAULT_LOGGING and LOGGING and the message was written to both files.

Yes, I have read that. And I was not expecting admin email behaviour to break. But the below configuration breaks the admin email functionality, I have a test case where DEBUG=False and emails stop being sent. Removing the LOGGING completely OR re-adding mailadmin handler and logger makes it work again.

Can you share your LOGGING config?

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'verbose': {
            'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
        },
        'simple': {
            'format': '%(levelname)s %(message)s'
        },
    },
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
            'stream': sys.stdout,
            'formatter': 'simple'
        },
    },
    'loggers': {
        'django': {
            'handlers': ['console'],
            'level': 'INFO',
            'propagate': True,
        },
    }
}
Last edited 10 years ago by Peter Lauri (previous) (diff)

comment:11 by Peter Lauri, 10 years ago

You don't need to share your config, I get what you mean, had to read it again :)

But still it remains unclear why the above LOGGING conf breaks the email sending.

In my test case I use the in memory mail backend, and mails are not being sent anymore using the above configuration.

Note: See TracTickets for help on using tickets.
Back to Top