Monolog Version 3.8.0: Empty Lines Generated in Logs When Using includeStacktraces with a Filter
eusonlito opened this issue · 1 comments
eusonlito commented
In Monolog version 3.8.0, empty lines are being generated in the logs when using includeStacktraces defined with a filter. Below is the configuration used and an example of the generated logs.
/**
* @return \Monolog\Formatter\LineFormatter
*/
protected function formatter(): LineFormatter
{
$production = app()->isProduction();
$formatter = new LineFormatter(null, 'c', true, true);
$formatter->setMaxNormalizeDepth(1000);
$formatter->includeStacktraces(true, static fn ($line) => ($production || !str_contains($line, '/vendor/laravel/')) ? $line : null);
return $formatter;
}
Example of Generated Logs:
#32 /var/www/app/Domains/Core/Controller/ControllerAbstract.php(82): call_user_func_array()
#33 /var/www/app/Domains/Core/Controller/ControllerWebAbstract.php(116): App\\Domains\\Core\\Controller\\ControllerAbstract->actionCall()
#34 /var/www/app/Domains/Core/Controller/ControllerWebAbstract.php(135): App\\Domains\\Core\\Controller\\ControllerWebAbstract->actionIfExists()
#35 /var/www/app/Domains/Course/Controller/UpdateCourseSection.php(20): App\\Domains\\Core\\Controller\\ControllerWebAbstract->actionPost()
#42 /var/www/app/Domains/Core/Controller/ControllerAbstract.php(40): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#44 /var/www/app/Domains/User/Middleware/Enabled.php(24): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#46 /var/www/app/Domains/User/Middleware/Request.php(25): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#48 /var/www/app/Domains/IpLock/Middleware/Check.php(20): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#50 /var/www/app/Http/Middleware/MessagesShareFromSession.php(23): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#66 /var/www/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(66): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#68 /var/www/app/Domains/Language/Middleware/Request.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#70 /var/www/app/Http/Middleware/Reset.php(22): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#72 /var/www/app/Http/Middleware/RequestLogger.php(20): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#78 /var/www/app/Http/Middleware/Https.php(23): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#83 /var/www/public/index.php(52): Illuminate\\Foundation\\Http\\Kernel->handle()
#84 {main}
"}
I am unsure when this issue started occurring.
Thanks!
eusonlito commented
Thanks!