0

I have an application deployed on Heroku and sometimes it throws the server error 500 randomly. I am trying to implement logging in my project. I am reading the docs but I am missing some critical piece of information. The docs say, Once you have configured your loggers, handlers, filters and formatters, you need to place logging calls into your code. My question is where exactly to put the logging code because I have already used try-except for all the parts, as far as I know, that may throw an error?

I have done a tutorial on the topic and reading the docs but that doesn't seem to convey the message to me.

Kaptan Singh
  • 253
  • 4
  • 12

1 Answers1

0

I also sometimes deploy to Heroku, and like the combination of Papertrail and Sentry.

  • Papertrail I use for logging, including print statements to the console.
  • Sentry I setup for the error handling, such as what you mention random 500 errors. The plugin for Django automatically connects the 500 errors you see under debug mode and sends that information to their cloud for further processing

For Heroku both are readily available on the marketplace

Boris
  • 490
  • 5
  • 11
  • Is it not possible to set up some basic logging using the logging module? I am trying to do that because I will probably switch to PythonAnywhere in the future. – Kaptan Singh Sep 04 '19 at 05:27
  • Sure you can, but if you are already using Heroku, why not enable these two plugins and get logging up and running faster than you can do you basic logging. And with Django, it's not like you are making it impossible to switch. If you end up switching, then you can implement a basic logging anytime. But why not worry about that when you want to switch? – Boris Sep 11 '19 at 14:49