PHP 클래스 Tools\Error\Middleware\ErrorHandlerMiddleware

Custom ErrorHandler to not mix the 404 exceptions with the rest of "real" errors in the error.log file. All you need to do is in your Application.php file for new ErrorHandlerMiddleware(): - Switch use Cake\Error\Middleware\ErrorHandlerMiddleware; with use Tools\Error\Middleware\ErrorHandlerMiddleware; - Make sure you got the 404 log defined either in your app.php or as Log::config() call. Example config as scoped one: - 'className' => '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.
상속: extends Cake\Error\Middleware\ErrorHandlerMiddleware
파일 보기 프로젝트 열기: dereuromark/cakephp-tools

공개 메소드들

메소드 설명
__construct ( string | callable | null $renderer = null, array $config = [] )

보호된 메소드들

메소드 설명
logException ( Psr\Http\Message\ServerRequestInterface $request, Exception $exception ) : void Log an error for the exception if applicable.

메소드 상세

__construct() 공개 메소드

public __construct ( string | callable | null $renderer = null, array $config = [] )
$renderer string | callable | null The renderer or class name to use or a callable factory.
$config array Configuration options to use. If empty, `Configure::read('Error')` will be used.

logException() 보호된 메소드

Log an error for the exception if applicable.
protected logException ( Psr\Http\Message\ServerRequestInterface $request, Exception $exception ) : void
$request Psr\Http\Message\ServerRequestInterface The current request.
$exception Exception The exception to log a message for.
리턴 void