I've deployed a Laravel app to heroku by following the official guide. It says to change APP_LOG=errorlog
, which I've done.
I've also tried two different versions of this, the commented line being the variation.
$this->app->configureMonologUsing(function($monolog){
// $monolog->pushHandler(new \Monolog\Handler\SyslogHandler('papertrail'));
$monolog->pushHandler(new \Monolog\Handler\StreamHandler('php://stderr', \Monolog\Logger::WARNING));
});
If I use Log::error('something') I'm not seeing anything. I'm looking in both papertrail, and the CLI command heroku logs --tail --app {appname}
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.
So start heroku logs --tail in one shell or command prompt and then run the deploy step in another window, and you should see logs appear in the first, hopefully with an error that we can then solve.
By default, Laravel is configured to create a single log file for your application, and this file is stored in app/storage/logs/laravel. log .
If you find an error message that you don't understand, try checking out the following resources: Heroku Error Codes (H12, R14, R15, H10, H14 etc.) - https://devcenter.heroku.com/articles/error-codes. Postgres Errors - https://devcenter.heroku.com/articles/postgres-logs-errors.
You must set LOG_CHANNEL=errorlog
as a Heroku environment variable.
This setting is for Laravel 5.6, in older versions it was other. (and that "old" information is found on most internet sites, when searching for the problem)
This information can be found in .env
file, which values must be manually set in Heroku.
Why?
The .env
is not transferred to heroku, because it is listed in .gitignore
.
BTW: I had the same issue today, seems like the setting you tried was valid for an older version of Laravel. I now use 5.6.
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