Interface for error logging handlers.
Used by the ErrorHandlerMiddleware and global error handlers to log exceptions and errors.
Interface for PHP error rendering implementations
The core provided implementations of this interface are used by Debugger and ErrorTrap to render PHP errors.
Interface ExceptionRendererInterface
Base error handler that provides logic common to the CLI + web error/exception handlers.
Subclasses are required to implement the template methods to handle displaying the errors in their environment.
Error Handler for Cake console. Does simple printing of the exception that occurred and the stack trace of the error.
Provide custom logging and error handling.
Debugger extends PHP's default error handling and gives simpler to use more powerful interfaces.
Error Handler provides basic error and exception handling for your application. It captures and handles all unhandled exceptions and errors. Displays helpful framework errors when debug mode is on.
When debug mode is off a ExceptionRenderer will render 404 or 500 errors. If an uncaught exception is thrown and it is a type that ExceptionRenderer does not know about it will be treated as a 500 error.
You can implement application specific exception handling in one of a few ways. Each approach gives you different amounts of control over the exception handling process.
exceptionRenderer option to inject an Exception renderer. This will
let you keep the existing handling logic but override the rendering logic.This gives you full control over the exception handling process. The class you choose should be loaded in your config/error.php and registered as the default exception handler.
exceptionRendererIf you don't want to take control of the exception handling, but want to change how exceptions are
rendered you can use exceptionRenderer option to choose a class to render exception pages. By default
Cake\Error\ExceptionRenderer is used. Your custom exception renderer class should be placed in src/Error.
Your custom renderer should expect an exception in its constructor, and implement a render method. Failing to do so will cause additional errors.
Using the built-in exception handling, you can log all the exceptions
that are dealt with by ErrorHandler by setting log option to true in your config/error.php.
Enabling this will log every exception to Log and the configured loggers.
Error handler also provides the built in features for handling php errors (trigger_error).
While in debug mode, errors will be output to the screen using debugger. While in production mode,
errors will be logged to Log. You can control which errors are logged by setting
errorLevel option in config/error.php.
When ErrorHandler is used for handling errors, you can enable error logging by setting the log
option to true. This will log all errors to the configured log handlers.
You can control which errors are logged / displayed by ErrorHandler by setting errorLevel. Setting this
to one or a combination of a few of the E_* constants will only enable the specified errors:
$options['errorLevel'] = E_ALL & ~E_NOTICE;
Would enable handling for all non Notice errors.
Log errors and unhandled exceptions to Cake\Log\Log
Entry point to CakePHP's error handling.
Using the register() method you can attach an ErrorTrap to PHP's default error handler.
When errors are trapped, errors are logged (if logging is enabled). Then the Error.beforeRender event is triggered.
Finally, errors are 'rendered' using the defined renderer. If no error renderer is defined in configuration
one of the default implementations will be chosen based on the PHP SAPI.
Backwards compatible Exception Renderer.
Entry point to CakePHP's exception handling.
Using the register() method you can attach an ExceptionTrap to PHP's default exception handler and register
a shutdown handler to handle fatal errors.
When exceptions are trapped the Exception.beforeRender event is triggered.
Then exceptions are logged (if enabled) and finally 'rendered' using the defined renderer.
Stopping the Exception.beforeRender event has no effect, as we always need to render
a response to an exception and custom renderers should be used if you want to replace or
skip rendering an exception.
If undefined, an ExceptionRenderer will be selected based on the current SAPI (CLI or Web).
Represents a fatal error
Object wrapper around PHP errors that are emitted by trigger_error()