DEV Community

loading...

Logging with Laravel on Heroku

AutoIdle
We are building a Heroku Addon that helps you save money by automatically putting your non-critical apps to sleep after a period of inactivity.
Originally published at Medium on ・1 min read

Laravel on Heroku — Tip #5

Photo by Markus Spiske on Unsplash

Laravel by default will log errors and messages into a directory on disk, which isn’t ideal, because Heroku uses an ephemeral filesystem, that means that any changes to the filesystem whilst the dyno is running only last until that dyno is shut down or restarted. Each dyno boots with a clean copy of the filesystem from the most recent deploy. This is similar to how many container-based systems, such as Docker, operate.

Change the log destination on Heroku:

heroku config:set LOG\_CHANNEL=errorlog
Enter fullscreen mode Exit fullscreen mode

Now you can tail the logs live:

heroku logs -t
Enter fullscreen mode Exit fullscreen mode

That’s it. 🚀

Want more tips like these?

You should follow me on Twitter! And if you’re building on Heroku, you should check out AutoIdle — the automated way to save money on your staging and review apps.

Discussion (0)