Re: How to catch and log exceptions?

2011-06-14 Thread Roy Smith
Exactly what I was looking for. Thanks! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com

Re: How to catch and log exceptions?

2011-06-14 Thread Shawn Milochik
Yes, you can access the traceback from the middleware. Just call logger.exception() instead of something like logger.debug() and you'll get the output in your log. Here's my middleware: import logging logger = logging.getLogger(__name__) class RequestExceptionMiddleware(object): """

How to catch and log exceptions?

2011-06-14 Thread Roy Smith
I want to catch any exceptions thrown in my views (or anywhere else, I suppose) and log a full stack trace. I know I can write middleware which implements process_exception(), but that just gets me the naked exception object, not a full stack dump. I'm assuming that by the time my process_excepti