I have a PHP app deployed on Heroku, but I can't seem to locate the apache error log. Using the command $heroku logs
I seem to get only the apache access logs. So a bunch of GET 200 OK etc, but no error information that is put into the error log locally, such as 'PHP Fatal error: blah blah'
Where do I access these error logs on Heroku, or how do I tell the app to write to Heroku's log like it does the local error log?
I feel like I'm overlooking something obvious but I can't seem to find a solution.
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. Retrieve logs from your log drain instead.
Heroku recognizes an app as PHP by the existence of a composer. json file in the root directory. The composer. json file specifies the dependencies that should be installed with your application.
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.
Router logs are a special case of logs that exist somewhere between the application logs and the system logs and are not fully documented on Heroku's website at the time of writing. They carry information about HTTP routing within Heroku's Common Runtime, which manages dynos isolated in a single multi-tenant network.
After a lot of experimentation, it looks like you need to comment out error_log
in php.ini
and make sure log_errors = on
.. this should output your errors to stderr where the heroku logplex can pick up the stream, then monitor with heroku logs --tail
.. I launched a heroku facebook app and looked at their phpinfo() and copied the setup.
Try adding:
error_reporting(E_ALL);
ini_set("display_errors", 1);
To the very top of your PHP page/app
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