@wheeler Thanks for this.
I just tried to extend to create daily log files based on the log level.
protected function getMonologHandler()
{
$d = date('Y-m-d');
$handlers = [];
$handlers[] = (new StreamHandler(storage_path("logs/ln_info_{$d}.log"), Logger::INFO))->setFormatter(new LineFormatter(null, null, true, true));
$handlers[] = (new StreamHandler(storage_path("logs/ln_warning_{$d}.log"), Logger::WARNING))->setFormatter(new LineFormatter(null, null, true, true));
$handlers[] = (new StreamHandler(storage_path("logs/ln_error_{$d}.log"), Logger::ERROR))->setFormatter(new LineFormatter(null, null, true, true));
$handlers[] = (new StreamHandler(storage_path("logs/ln_critical_{$d}.log"), Logger::CRITICAL))->setFormatter(new LineFormatter(null, null, true, true));
return $handlers;
}
Log::info('Sent data');
When I try to log the data, multiple log files are created, with the same log data instead of in just one file.
The similar code has worked for me in Laravel but creates multiple files in Lumen.
Any clue what I'm missing?