Reputation: 149
I am using laravel monolog to separate INFO, WARNING, and ERROR logs
link : https://laracasts.com/discuss/channels/general-discussion/advance-logging-with-laravel-and-monolog
I have copied and it is working.
My only problem is about the ERROR logging,
when we check out daily error logs it looks good and line breaks every number e.g.
Stack trace:
#0 'Error exception with message of undefined'
#1 .../location line (44)
but the custom logging does not line break with these numbers. Is this normal or i have did something wrong in my configuration?
i have tried to use a formatter and doesnt work still
$logFormat = "%datetime% [%level_name%] (%channel%): %message% %context% %extra%\n";
$formatter = new LineFormatter($logFormat);
$errorStreamHandler->setFormatter($formatter);
$infoStreamHandler->setFormatter($formatter);
the error still looks like shown below without any line breaks
Stack trace: #0 'Error exception with message of undefined' #1 .../location line (44)
Is there a workaround to have the line break after every number line
Thanks
Upvotes: 2
Views: 1232
Reputation: 21
Check the LineFormatter documentation (https://github.com/Seldaek/monolog/blob/master/src/Monolog/Formatter/LineFormatter.php) and set allowInlineLineBreaks to true when creating a new formatter, like so:
$formatter = new LineFormatter($logFormat, null, true);
Upvotes: 2