Django Sentry Giving an Error in Development Environment
I'm running django-sentr开发者_高级运维y successfully in our staging and production environments, but on my development instance sentry doesn't appear to be logging.
I'm using manage runserver, and when a 500 error occurs I'm getting this in the console:
Development server is running at http://192.168.56.100:8080/
Quit the server with CONTROL-C.
No handlers could be found for logger "sentry.errors"
[20/Apr/2011 17:26:56] "POST .... HTTP/1.1" 500 126470
I've set the following in local_settings:
DEBUG = True
SENTRY_TESTING = True
Google searches have turned up nothing for the "No handlers..." error message - any ideas?
In your settings.py on your dev box that isn't logging, add something like this:
import logging
logger = logging.getLogger("sentry.errors")
handler = logging.StreamHandler()
formatter = logging.Formatter("[%(levelname)s] %(name)s: %(message)s")
handler.setFormatter(formatter)
logger.addHandler(handler)
So assuming you're using the standard manage.py runserver on your development desktop, that will open a StreamHandler() which writes to standard error and you should see on your console.
You could also change StreamHandler() ---> FileHandler("/tmp/debug.log", "w")
The fact that it is logging to the sentry.errors handler says that there is a misconfiguration with your dev sentry configuration / settings.
精彩评论