'Cake\Log\Engine\FileLog', * - 'path' => LOGS, * - 'file'=> '404', * - 'levels' => ['error'], * - 'scopes' => ['404'] * * If you don't want the errors to also show up in the debug and error log, make sure you set * `'scopes' => false` for those two in your app.php file. * * In case you need custom 404 mappings for some additional custom exceptions, make use of `log404` option. * It will overwrite the current defaults completely. */ class ErrorHandler extends CoreErrorHandler { /** * Handles exception logging * * @param \Exception $exception Exception instance. * @return bool */ protected function _logException(\Exception $exception) { $blacklist = [ 'Cake\Routing\Exception\MissingControllerException', 'Cake\Routing\Exception\MissingActionException', 'Cake\Routing\Exception\PrivateActionException', 'Cake\Routing\Exception\NotFoundException', 'Cake\Datasource\Exception\RecordNotFoundException', 'Cake\Network\Exception\MethodNotAllowedException', 'Cake\Network\Exception\BadRequestException', 'Cake\Network\Exception\ForbiddenException', 'Cake\Network\Exception\GoneException', 'Cake\Network\Exception\ConflictException', 'Cake\Network\Exception\InvalidCsrfToken', 'Cake\Network\Exception\UnauthorizedException', 'Cake\Network\Exception\NotAcceptableException', ]; if (isset($this->_options['log404'])) { $blacklist = $this->_options['log404']; } if ($blacklist && in_array(get_class($exception), (array)$blacklist)) { $level = LOG_ERR; Log::write($level, $this->_getMessage($exception), ['404']); return false; } return parent::_logException($exception); } }