11

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}

Sebastian D'Agostino
  • 1,575
  • 2
  • 27
  • 44
Kevin Redman
  • 459
  • 4
  • 15

1 Answers1

12

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.

frankfurt-laravel
  • 3,731
  • 2
  • 20
  • 29
  • I had trouble finding 'old' setting for version 5.3 so here it is just for reference: APP_LOG=errorlog, when I set this in heroku settings-> config vars, then I see the logs. This env variable is used in config/app.php on version 5.3 and default value is 'single' which sets writing to storage/logs/laravel.log file. – pera Oct 26 '18 at 09:55
  • It's worth mentioning that Heroku's official docs for Laravel specifically have not been updated. `LOG_CHANNEL` is in fact the correct environment variable to set to have Laravel application logs to show up in `heroku logs` – Dylan Pierce Nov 20 '18 at 22:42
  • @frankfurt-laravel : I have updated the same in laravel 7 but still no success – svikramjeet Oct 01 '20 at 16:46