yceruto/django-ajax

Not receveing ADMIN error emails

paolobb4 opened this issue · 3 comments

I can't debug my deployed application because django-ajax is catching all errors and I'm not getting the ADMIN emails :/
(I'm now thinking of sending the error back from client side just to report it @_@)

Maybe there's a way to force admin error emails?

Hi @paolobb4 probably I need to disable it on non-debug mode.

I also keep gettin this message whenever django-ajax catches an error. I guess there's a problem with the logging settings(?
No handlers could be found for logger "django_ajax.shortcuts"

Sorry, my bad. I hadn't set logging settings because I assumed that there was a default "catch all" logger but that's not the case.

For anyone else who finds themselves with the same problem, I solved it by copying django's default logging settings to the project settings and adding a default logger like so:

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    # ... other logging settings
    'loggers':
        # ... other loggers
        '': { # default, "catch all" logger
            'handlers': ['console', 'mail_admins'],
            'level': 'DEBUG',
            'propagate': True,
        },
    }
}

Of course you must also set ADMINS in the setting, and as an added bonus (check this stackoverflow answer) set SERVER_EMAIL, otherwise it defaults to 'root@localhost' and most email providers don't accept requests from such a suspicious address.