I add this on my bootstrap/app.php:
$app->configureMonologUsing(function(\Monolog\Logger $monolog) {
$formatter = new \Monolog\Formatter\LineFormatter(null,null,false,true);
$stdOut = new \Monolog\Handler\StreamHandler('php://stdout',\Monolog\Logger::DEBUG);
$stdOut->setFormatter($formatter);
$monolog->pushHandler($stdOut);
$file = storage_path('logs/mono-'. Date('Y-m-d', time()) . '.log');
$monolog->pushHandler(new \Monolog\Handler\StreamHandler($file));
});
PhpVersion:5.6
LaravelVersion:5.2
Env:3.10.0-1062.18.1.el7.x86_64
Env is a docker pod.
But it cannot not print log on stdout. No log found out. Is there someone know how to fix this.
by the way, Laravel 5.2 has a built-in logger:
Log::info($YOUR_VARIABLE); (or \Log::info($YOUR_VARIABLE);)
read the documentation carefully: https://laravel.com/docs/5.2/errors#introduction