I am using Flask on Heroku right now and I want to be able to log errors to a file (via FileHandler).
I don't think that's officially supported by heroku.
On heroku's logging page there's some mentioning of syslogs and drains, which seem pretty complicated to set up.
I want something quick and easy. Any recommendations?
You can view logs with the Heroku CLI, the dashboard, your logging add-on, or in your log drain. You can't view logs for apps in Shield spaces with Private Space Logging enabled.
Resolution. Apps that exceed a threshold of log output over a period of time can have their Heroku-provided log buffer disabled, meaning that only heroku logs --tail (live log tailing) will display logs. Note that this does not affect external log drains in any way.
If running heroku local does not help, run a remote shell: heroku run -a <your app name> /bin/bash , and there run npm start to see the logs and debug the issue on the Heroku server.
Anything your app writes to stdout
will end up in Heroku's consolidated log for your application, according to their docs, which you can then access with heroku log
and the other tools. That's probably the quickest/easiest way to get logs from your app to a place you can look at them.
Follow on heroku logging
To view your logs we have:
heroku logs
heroku logs -n 200
heroku logs --tail
heroku logs --app your_app_name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With