Re: logging view errors

2011-05-10 Thread Florian Apolloner
Hi,

On May 10, 11:33 pm, Shawn Milochik  wrote:
> You and someone on django-users both told me about process_exception,
> which I had been unaware of. It looks perfect for what I need.

There is also a signal for it: 
http://docs.djangoproject.com/en/dev/ref/signals/#got-request-exception
if you don't want to write the middleware ;)

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: logging view errors

2011-05-10 Thread Shawn Milochik

On 05/10/2011 04:52 PM, Michael Blume wrote:
A developer can currently do this pretty easily with middleware by 
setting a process_exception method. We could provide some contrib 
middleware for logging exceptions, but I don't see any need to bring 
this into core.


-Mike



Mike,

You and someone on django-users both told me about process_exception, 
which I had been unaware of. It looks perfect for what I need.


Thanks,
Shawn


--
You received this message because you are subscribed to the Google Groups "Django 
developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: logging view errors

2011-05-10 Thread Michael Blume
A developer can currently do this pretty easily with middleware by setting a
process_exception method. We could provide some contrib middleware for
logging exceptions, but I don't see any need to bring this into core.

-Mike

On Tue, May 10, 2011 at 1:26 PM, Shawn Milochik  wrote:

> I think this is something I'd like to open up a ticket for, but first I
> want to see whether it's already possible, or is overruled by existing
> design decisions.
>
> Desire:
> Now that logging is built into Django, I think that any time there is an
> exception in a view a logging.exception message should be sent.
>
> Currently, if you create a logging handler to handle 'django' or
> 'django.request' there is no 'logging' call for the exception.
>
> Justification:
> Without this, a developer would have to needlessly complicate all views
> with exception handlers or apply a decorator universally across all views to
> ensure that this information (including the stack trace, which comes for
> free with logging.exception) is logged.
>
> Use cases:
>
> 1. For a view accessed via AJAX, if there is an error in a view a 500 (or a
> 403 for a missing CSRF token) error will occur, but nothing is logged and
> there is no obvious way to figure out what broke. This is mainly useful
> during development.
>
> 2. In production, it would be helpful to be able to check the log for these
> errors to preemptively fix bugs.
>
> Thank you for your time.
>
> Shawn
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To post to this group, send email to django-developers@googlegroups.com.
> To unsubscribe from this group, send email to
> django-developers+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-developers?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



logging view errors

2011-05-10 Thread Shawn Milochik
I think this is something I'd like to open up a ticket for, but first I 
want to see whether it's already possible, or is overruled by existing 
design decisions.


Desire:
Now that logging is built into Django, I think that any time there is an 
exception in a view a logging.exception message should be sent.


Currently, if you create a logging handler to handle 'django' or 
'django.request' there is no 'logging' call for the exception.


Justification:
Without this, a developer would have to needlessly complicate all views 
with exception handlers or apply a decorator universally across all 
views to ensure that this information (including the stack trace, which 
comes for free with logging.exception) is logged.


Use cases:

1. For a view accessed via AJAX, if there is an error in a view a 500 
(or a 403 for a missing CSRF token) error will occur, but nothing is 
logged and there is no obvious way to figure out what broke. This is 
mainly useful during development.


2. In production, it would be helpful to be able to check the log for 
these errors to preemptively fix bugs.


Thank you for your time.

Shawn


--
You received this message because you are subscribed to the Google Groups "Django 
developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.