I want to log errors to my own logging system, without interfering with other logging.
The following option is often suggested, but “error_get_last” no longer returns errors as soon as a custom handler is set with set_error_handler.
register_shutdown_function(function () {
$error = error_get_last();
if ($error !== NULL) {
echo "Shutdown error: [{$error['type']}] {$error['message']} in {$error['file']} on line {$error['line']}n";
}
});
Is it possible to set a custom handler and not overwrite others?