Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel logs in Heroku not showing up

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}

like image 683
Kevin Redman Avatar asked Nov 24 '17 13:11

Kevin Redman


People also ask

How do I check my heroku heroku logs?

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.

How do I fix heroku logs?

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.

Where can I see laravel logs?

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 .

How do I check my application error in heroku?

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.


1 Answers

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.

like image 98
frankfurt-laravel Avatar answered Oct 19 '22 04:10

frankfurt-laravel