S
S
Shporsoft2020-11-02 09:06:21
Django
Shporsoft, 2020-11-02 09:06:21

How to store tracebacks in models?

I'm making a control panel that shows website statistics. I want to count how many 500 errors there were on the site (I can easily do this myself) and save their tracebacks in the model:

class ErrorStore(models.Model):
         error_code = models.IntegerField() #код ошибки
         traceback = models.TextField() #текст ошибки

And so I should make so that the text of an error would be saved in this model. How to implement it? Or is it much better to use debug.log files?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikita, 2020-11-02
@Shporsoft

When you start the production server, debugging will be disabled in your settings (DEBUG = False) and users will not see a 500 or 404 error. Django has an email error reporting tool for this.

R
Roman Kitaev, 2020-11-02
@deliro

There are many correct options: Sentry, ELK, Prometheus + Grafana

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question