Monday, January 28, 2019

Re: Logging of full trace with Debug set to False

Hi Anirudh,

I am using uWSGI and not Gunicorn. At least for uWSGI, with Debug = False, it only logs the HTTP status code but not exception (might be the same with Gunicorn).
I will try Sentry which provides a clean GUI and notification of new problems. This also seems to work for my Celery tasks and Django admin commands.

Thank you very much for your reply!

Kevin

Am Montag, 28. Januar 2019 13:25:17 UTC+1 schrieb Anirudh Jain:
You  can setup a logging and debugging logging system using gunicorn in production using flags :-

--log-level debug
--access-logfile /home/ubuntu/websitelogs.log

For more setting options read gunicorn documentation 


On Mon, 28 Jan 2019, 16:50 Michal Petrucha <michal....@koniiiik.org wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On Mon, Jan 28, 2019 at 02:53:55AM -0800, Kevin Olbrich wrote:
> Hi!
>
> I would like to catch and send all exceptions to a logging system.
> When Debug is set to False, all debug related information is lost (just a
> HTTP 500 error message).
>
> While Debug False works perfectly in production, I would like to log and
> send the exceptions to a backend, where I can save them.
> This would allow me to fix bugs, that only occur once every month (because
> nobody is able to reproduce).
>
> Similar approach was the case with Testflight on iOS, where I got a message
> for every App-crash.
>
> How can I handle this?
>
> Kind regards
> Kevin

Hi Kevin,

You can set up your backend logging to send logs to Sentry [1], for
example. You can either set up your own Sentry instance, or use the
commercial offering [2]. If you set up sentry as one of the default
logging handlers, it will catch all unhandled exceptions, and you'll
get a fancy stack trace for each, including the values of local
variables in each stack frame.

Cheers,

Michal


[1]: https://github.com/getsentry/sentry
[2]: https://sentry.io/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCgAGBQJcTuVkAAoJEHA7T/IPM/kl5skQAOVvT+gu33Cn9YuM5152LaN/
hO8jQ5qC85k62+Z+3ptx8xsLOSPpbivdrAWOEW2asgRUFpSzdvsvDpF5ARWUlO9D
3s7bTfNqnPATDjEdiBep4ZQd5eWtkw7aMhHOS6gnwl60zEqlH62MIqOj9NFRL5YV
MMsCTAnqcB2IqXsiGmpxUvc5c20WHac4ODwOkOBAY4CPd1O6s1bf44LtD2bTaJTR
py7KvwKJ+4wkhM89cjnP5etIhdsnPbv+hKry40rji/J/k8VAz2w702jnRc5W6a8d
mPlBYfdZS/tfnNDx+TO+fKgwny1xrrE55vXabVgyt3nQF+KQluf2Zw2Q4HzDhhZ+
6L0QU2xR+EzFHsXCdhUAVF9+0h6guJzNQ7qsSz9KlZoGB5a2Jdk8Q4ji/RBVaORx
GEZpRw/VWTn7/mLvCdOxOH8J/IMf9avyEm+CK8K23BMFqO7ydmtUIboN/MVQ1UJA
4Xjp3vm1zB5hcaS9AjAJ5/vn9ySPjE9deoBxqUuN7I30Vug/EqqDhBhqOCiiwp4p
V6OwPMqhhZig3cvmigvwhZoT+WXUQwrGAGodleBon8ajIUcB1dxyxbPnbeIzSKPg
9lNot8WLlQEwYN7HWVQRMTc0NtLRg4YTI7UZWcwAneznxrCwKyzdQV3PhiN5A1Kh
VRcuK/Cf70seqQEarfXL
=HFoa
-----END PGP SIGNATURE-----

--
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.
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/20190128112004.GD10973%40koniiiik.org.
For more options, visit https://groups.google.com/d/optout.

--
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-users@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/9c197ce1-54d1-4291-9cc4-22b3cb5b58fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment