-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Labels
Milestone
Description
This is a (multiple allowed):
- bug
- enhancement
- feature-discussion (RFC)
- CakePHP Version: 4.0.
- Platform and Target: apache, mysql, any request that throws an exception
What you did
In config/app.php
I have configured a custom errorLogger
'Error' => [
'errorLevel' => E_ALL,
'exceptionRenderer' => \Cake\Error\ExceptionRenderer::class,
'skipLog' => [],
'log' => true,
'trace' => true,
'errorLogger' => \App\Error\ErrorLogger::class,
],
Expected Behavior
I expect that any logging was handled by App\Error\ErrorLogger
Actual Behavior
Every exception is handled by Cake\Error\ErrorLogger
.
I think that Cake\Error\Middleware\ErrorHandlerMiddleware
should read from configuration if no config is passed to the constructor.
One way to solve it without changing core behavior is to get configuration in ErrorHandlerMiddleware
constructor in Application.php
, like so:
$middlewareQueue->add(new ErrorHandlerMiddleware(Configure::read('Error')))
My opinion though, for what it's worth, is that it should attempt to use app configuration by default.