#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)
Change History (12)
comment:1 by , 10 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 10 years ago
Type: | Uncategorized → Cleanup/optimization |
---|
comment:3 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
by , 10 years ago
Attachment: | 0001-updated-error-reporting-documentation-as-per-ticket-.patch added |
---|
documentation patch
comment:4 by , 10 years ago
Does "0001-updated-error-reporting-documentation-as-per-ticket-.patch" work?
comment:5 by , 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 , 10 years ago
Owner: | removed |
---|---|
Status: | assigned → new |
comment:7 by , 10 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
follow-up: 10 comment:9 by , 10 years ago
Has patch: | unset |
---|---|
Resolution: | → invalid |
Status: | assigned → closed |
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.
comment:10 by , 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, }, } }
comment:11 by , 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.
I could see slightly improved wording being helpful, though it would be nice to not increase the amount of text too much.