Local variable dump on exception in production environment (DEBUG=False)

27 views
Skip to first unread message

Web Architect

unread,
Feb 1, 2019, 5:11:47 AM2/1/19
to Django users
Hi,

In our production environment, we receive mail whenever an exception happens in our django application. But it contains only the function traces. The log will be helpful it also contains data dump or the local variable dump for each function trace. 
The exception trace on the browser in our development environment (DEBUG=True) contains the local variable dump. 

Hence, could anyone let me know if it's possible to get the local variable dump during exceptions in our django application? 

Thanks.

vineeth sagar

unread,
Feb 1, 2019, 5:30:13 AM2/1/19
to django...@googlegroups.com
Hi, 

I am not sure about django, but you can have a look at sentry, we use it in production and it gives everything you ask for. I am sure Django also does it but I find sentry better for error reporting.

regards
Vineeth

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5b32c8ae-eb93-425d-88dc-d2c2a775a487%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Web Architect

unread,
Feb 1, 2019, 6:15:32 AM2/1/19
to Django users
Hi Vineeth,

Thanks for the info. Sentry sounds interesting and we will have a look at Sentry as it might need integration. 

Django does report function trace via mails but we are looking for the local variable trace also . Was hoping a small tweak in django should help. 

Thanks.

On Friday, February 1, 2019 at 4:00:13 PM UTC+5:30, vineeth sagar wrote:
Hi, 

I am not sure about django, but you can have a look at sentry, we use it in production and it gives everything you ask for. I am sure Django also does it but I find sentry better for error reporting.

regards
Vineeth
On Feb 1, 2019 3:41 PM, "Web Architect" <pina...@gmail.com> wrote:
Hi,

In our production environment, we receive mail whenever an exception happens in our django application. But it contains only the function traces. The log will be helpful it also contains data dump or the local variable dump for each function trace. 
The exception trace on the browser in our development environment (DEBUG=True) contains the local variable dump. 

Hence, could anyone let me know if it's possible to get the local variable dump during exceptions in our django application? 

Thanks.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

vineeth sagar

unread,
Feb 1, 2019, 10:59:37 AM2/1/19
to django...@googlegroups.com
Ha, Hope you find a solution with django itself, sentry integration is just two lines and boom all uncaught exceptions, logger.error,exception,critical are automatically reported. Goodluck

regards
Vineeth

Simon Charette

unread,
Feb 1, 2019, 11:45:53 AM2/1/19
to Django users
Hello there,

I haven't tried it myself but you could try subclassing django.utils.log.AdminEmailHandler
to rely on the better-exceptions[0] package to _better_ format exceptions sent in text
emails or simply set the include_html option[1] to True in your LOGGING configuration to
get report similar to when DEBUG=True is enabled in development environment.

Cheers,
Simon

Web Architect

unread,
Feb 4, 2019, 1:36:17 AM2/4/19
to Django users
Hi Simon,

Thanks for your response. 

include_html was what I needed and the stack trace in mail contained the variable dump.

Thanks a lot. 
Reply all
Reply to author
Forward
0 new messages