Kritz
Kritz

Reputation: 7331

How to save log files in Django on Heroku

I have a Django app that is hosted on Heroku. Part of the app generates PDF files (using pdf latex). When an error occurs, I want to save a log file with details of the caused the errors as well as the original tex file. There could be 1000+ lines, so I can't make it part of the exception message.

Since it's running on Heroku, I guess I need to upload the file to S3. When I'm developing locally, I want to save it locally.

Is there a Django app that can do this or is there a better approach I should follow?

Note that I'm currently not using S3 for static assets (I'm using whitenoise)

Upvotes: 2

Views: 705

Answers (1)

rdegges
rdegges

Reputation: 33854

Heroku's logging is quite nice. You can view your logs in real-time, stream them to your own applications, or do anything you want with them.

If your goal is to simply capture the traceback exceptions when something fails, instead of writing custom code to save those logs to a database, I'd highly recommend you use a Heroku addon like:

Those make it really easy to find / handle errors like the ones you're describing. They'll email you automatically when problems arise =)

Upvotes: 3

Related Questions