Log message #4198270

# At Username Text
# 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
# Aug 15th 2019, 10:29 neothermic unsure how much cake might explode if I mock CakeLog
# Aug 15th 2019, 10:28 conehead Unfortunately (or fortunately? :)) I do not have a cake 2 setup anymore. But shouldn't it be possible to mock out that darn logger?
# Aug 15th 2019, 10:27 neothermic and neither is setting the Error up to be a file-only log :|
# Aug 15th 2019, 10:26 neothermic aw, and `Cakelog::disable('Error');` is _not_ the answer :)
# Aug 15th 2019, 10:24 challgren Damm