# |
Jul 24th 2021, 23:01 |
jojomartius |
which means ErrorHandlerMiddleware is not looking in the right config |
# |
Jul 24th 2021, 23:01 |
kevin.pfeifer |
or do you have ```Configure::consume( 'Error' )``` somewhere? |
# |
Jul 24th 2021, 23:00 |
jojomartius |
contains everthing |
# |
Jul 24th 2021, 22:59 |
kevin.pfeifer |
maybe try outputting ``` Configure::read( 'Error' )``` in your Application.php in the middleware function and see if everything is still there |
# |
Jul 24th 2021, 22:58 |
jojomartius |
mh no if i remove it from my bootstrap, its till rendering the expcetions - but its not takeing "skipLogs" into account ,:) |
# |
Jul 24th 2021, 22:56 |
kevin.pfeifer |
in my bootstrap.php |
# |
Jul 24th 2021, 22:56 |
kevin.pfeifer |
well I commented out ```( new ErrorHandler( Configure::read( 'Error' ) ) )->register();``` and it still worked |
# |
Jul 24th 2021, 22:55 |
jojomartius |
but somehow it feels bad to remove the errorhandlermiddleware |
# |
Jul 24th 2021, 22:55 |
jojomartius |
yes, indeed thats changing the behavior completly. removing ->add(ErrorHandlerMiddleware::class) helpts that the app.php is controlling the logging behavior |
# |
Jul 24th 2021, 22:54 |
kevin.pfeifer |
not the thing in the bootstrap.php |
# |
Jul 24th 2021, 22:54 |
kevin.pfeifer |
ok, its definitely the ErrorHandlerMiddleware in the Application.php which causes my logic |
# |
Jul 24th 2021, 22:53 |
jojomartius |
i removed the error handler from application.php and the nit works |
# |
Jul 24th 2021, 22:53 |
jojomartius |
but regarding https://github.com/cakephp/app/issues/842 |
# |
Jul 24th 2021, 22:53 |
jojomartius |
true taht |
# |
Jul 24th 2021, 22:52 |
kevin.pfeifer |
well thats a bit too harsh in my opinion ^^ If your not in sync with the app template then I would just go file by file and check what differs |
# |
Jul 24th 2021, 22:50 |
jojomartius |
but i guess the best way is just dropping the application into a seperate folder, starting with a new cakephp/app and migrating stuff over |
# |
Jul 24th 2021, 22:50 |
kevin.pfeifer |
let me check something |
# |
Jul 24th 2021, 22:50 |
jojomartius |
yes, you'r right. but i guess it came with 4.0 or something. too long ago |
# |
Jul 24th 2021, 22:48 |
jojomartius |
but the bad part is... also if i clear the skip log thing |
# |
Jul 24th 2021, 22:48 |
kevin.pfeifer |
well the Application.php is pretty important since it is used in literally the first php file loaded :) (webroot/index.php) |
# |
Jul 24th 2021, 22:48 |
jojomartius |
hehe ya now its not writing it into the logfile :) |
# |
Jul 24th 2021, 22:47 |
jojomartius |
i do remember that i somehow missed the point when the "Application.php" was introduced and i had some trouble to get it working, so maybe i did something stupid back in this days |
# |
Jul 24th 2021, 22:46 |
jojomartius |
well.. guess that could be the problem |
# |
Jul 24th 2021, 22:46 |
jojomartius |
but theres a lot of interesting stuff inside the "new" app |
# |
Jul 24th 2021, 22:45 |
kevin.pfeifer |
which is not the problem here because I got that too |
# |
Jul 24th 2021, 22:44 |
kevin.pfeifer |
I also just noticed, that there is an issue open for duplicate errorHandler instances created in the template https://github.com/cakephp/app/issues/842 |
# |
Jul 24th 2021, 22:43 |
kevin.pfeifer |
yea, keeping the project up2date with the cakephp/app template can be a bit challenging sometimes :) |
# |
Jul 24th 2021, 22:43 |
jojomartius |
i think thats a good point to start debugging :) |
# |
Jul 24th 2021, 22:43 |
jojomartius |
guess this comes from updating and upgrading from older cake versions over and over again ;) |
# |
Jul 24th 2021, 22:42 |
jojomartius |
yes, just compared config/boostrap.php with https://github.com/cakephp/app/blob/master/config/bootstrap.php, looks pretty different. but also replacing it with the standard one doesnt help |
# |
Jul 24th 2021, 22:37 |
kevin.pfeifer |
well then either look for `Configure::write` or check your `config/bootstrap.php` if some other config files are loaded which could overwrite your main config |
# |
Jul 24th 2021, 22:35 |
jojomartius |
you'r right. well i havn't foudn whats overwriting the config but when i dump getconfig in `vendor/cakephp/cakephp/src/Error/ErrorLogger.php` line 77, it says its an empty array |
# |
Jul 24th 2021, 22:32 |
jojomartius |
mh... yes there must be something overwriting my config... usually computers don't lie ;-) |
# |
Jul 24th 2021, 22:31 |
kevin.pfeifer |
you sure no other config overwrites your config set in app.php? |
# |
Jul 24th 2021, 22:30 |
kevin.pfeifer |
basically the decision/logic for that is present in `vendor/cakephp/cakephp/src/Error/ErrorLogger.php` line 77 If you got xdebug maybe step into there |
# |
Jul 24th 2021, 22:28 |
jojomartius |
`021-07-25 00:28:03 Error: [Cake\Http\Exception\MissingControllerException] Controller class Asdf could not be found. in /app/app/acb/vendor/cakephp/cakephp/src/Controller/ControllerFactory.php on line 226` Exception Attributes: array ( 'class' => 'Asdf', 'plugin' => NULL, 'prefix' => NULL, '_ext' => NULL, ) Request URL: /asdf Client IP: 172.19.0.1 |
# |
Jul 24th 2021, 22:28 |
jojomartius |
``` 'Error' => [ 'errorLevel' => E_ALL and ~E_USER_DEPRECATED and ~E_USER_NOTICE, 'exceptionRenderer' => 'Cake\Error\ExceptionRenderer', 'skipLog' => ['Cake\Http\Exception\MissingControllerException'], 'log' => true, 'trace' => true, ],``` |
# |
Jul 24th 2021, 22:28 |
jojomartius |
intresting |
# |
Jul 24th 2021, 22:27 |
kevin.pfeifer |
no error when adding ```'skipLog' => ['Cake\Http\Exception\MissingControllerException'],``` and calling an unkown URL |
# |
Jul 24th 2021, 22:27 |
kevin.pfeifer |
mhmm, it works for me :thinking_face: |
# |
Jul 24th 2021, 22:17 |
jojomartius |
Hey, i'm using Cakephp 4.2 and want to skip some error's from being logged (to much in production). I added in app.php Error.skipLog => ['Cake\Http\Exception\MissingControllerException'] but i still get messages when i try to visit random urls like /lkajsdf2 in logs/error.log. Did i get it wrong? |