# |
Aug 15th 2019, 11:13 |
spriz |
Ah, I'd believe so. Never used 2.x though |
# |
Aug 15th 2019, 11:12 |
neothermic |
no, 3.x is far more complex than 2.x |
# |
Aug 15th 2019, 11:12 |
spriz |
length of the book? :O |
# |
Aug 15th 2019, 11:12 |
neothermic |
this is part of why we're not yet on 3.x :) |
# |
Aug 15th 2019, 11:11 |
challgren |
Yeah not too much to it |
# |
Aug 15th 2019, 11:11 |
neothermic |
:) |
# |
Aug 15th 2019, 11:11 |
spriz |
Wow the 2.x book is short! :) |
# |
Aug 15th 2019, 11:11 |
spriz |
suggests to put it at `app/Lib/AppError.php` |
# |
Aug 15th 2019, 11:10 |
spriz |
that looks like it: https://book.cakephp.org/2.0/en/development/errors.html#creating-your-own-error-handler |
# |
Aug 15th 2019, 11:10 |
neothermic |
setErrorHandlers seems that it might do the trick |
# |
Aug 15th 2019, 11:10 |
neothermic |
mm, I'd also need to work out how to force cake to use them |
# |
Aug 15th 2019, 11:09 |
spriz |
It's ugly - I know :) but it'll work |
# |
Aug 15th 2019, 11:09 |
spriz |
make a class that overwrites `handleException` and `handlError` and remove those parts about `$stderr->write(__d('cake_console', "<error>%s Error:</error> %s\n", $name, $message)); |
# |
Aug 15th 2019, 11:08 |
spriz |
Ah yes! https://github.com/cakephp/cakephp/blob/2.x/lib/Cake/Console/ConsoleErrorHandler.php#L55 |
# |
Aug 15th 2019, 11:07 |
neothermic |
handleException/handleError |
# |
Aug 15th 2019, 11:07 |
spriz |
or something alike |
# |
Aug 15th 2019, 11:07 |
spriz |
don't you have something that has `$this->_stderr->write($message);` ? |
# |
Aug 15th 2019, 11:07 |
spriz |
yeah I should have scrolled up |
# |
Aug 15th 2019, 11:06 |
neothermic |
nope, did say it was 2.x :) |
# |
Aug 15th 2019, 11:06 |
spriz |
my bad :) |
# |
Aug 15th 2019, 11:06 |
spriz |
I forgot |
# |
Aug 15th 2019, 11:06 |
spriz |
Oh yikes, you are not on 3.x ......... :) |
# |
Aug 15th 2019, 11:06 |
neothermic |
`ConsoleErrorHandler` doesn't seem to have a `_displayException` :S |
# |
Aug 15th 2019, 11:05 |
spriz |
`/src/Console/SilentConsoleErrorHandler` |
# |
Aug 15th 2019, 11:04 |
neothermic |
where'd you create SilentConsoleErrorHandler ? :slightly_smiling_face: |
# |
Aug 15th 2019, 11:04 |
spriz |
YMMV |
# |
Aug 15th 2019, 11:04 |
spriz |
and changed from `(new ConsoleErrorHandler(Configure::read('Error')))->register();` to `(new SilentConsoleErrorHandler(Configure::read('Error')))->register();` in `bootstrap.php` |
# |
Aug 15th 2019, 11:03 |
spriz |
I extended `ConsoleErrorHandler`, changed `_displayException` to just `return;` and it was enough for me :slightly_smiling_face: |
# |
Aug 15th 2019, 11:02 |
spriz |
with cake log stuff going to stdio |
# |
Aug 15th 2019, 11:02 |
neothermic |
oooh, what you do to solve it? |
# |
Aug 15th 2019, 11:02 |
spriz |
@neothermic I had the same issue last friday :) :) |
# |
Aug 15th 2019, 10:35 |
challgren |
But I feel your pain! |
# |
Aug 15th 2019, 10:35 |
challgren |
Or deal with the garbage |
# |
Aug 15th 2019, 10:35 |
challgren |
I vote mock it |
# |
Aug 15th 2019, 10:34 |
neothermic |
``` Cakelog::drop('error'); CakeLog::config('error', array( 'engine' => 'File', 'types' => array('emergency', 'alert', 'critical', 'error'), ));``` |
# |
Aug 15th 2019, 10:34 |
neothermic |
nope |
# |
Aug 15th 2019, 10:33 |
neothermic |
hmm |
# |
Aug 15th 2019, 10:33 |
challgren |
But then can you reconfigure it to /dev/null? |
# |
Aug 15th 2019, 10:32 |
neothermic |
if you drop it, you get an error that there's no handler for that log type |
# |
Aug 15th 2019, 10:32 |
conehead |
Or can you get a list of all loggers with `CakeLog::configured` and then unset them via `CakeLog::drop($name)`? |
# |
Aug 15th 2019, 10:29 |
conehead |
Well usually it shouldnt at all...that is what mocks are for :P |