我正在尝试在set_exception_handler
and中使用 Monolog set_error_handler
,而在外面使用 Whoops。
我尝试了 2 个运行 Whoops 的位置。
Run Whoops #1 Location
- 结果:Monolog 记录错误/异常并且 Whoops 不显示
Run Whoops #2 Location
- 结果:Monolog 没有记录任何内容,并且显示 Whoops
我被困在为什么我不能让 Monolog 和 Whoops 一起工作。
...
use Whoops\Run;
use Whoops\Handler\PrettyPageHandler;
error_reporting(E_ALL);
ini_set('display_errors', 1);
//Run Whoops #1 Location
$whoops = new Run();
$whoops->prependHandler(new PrettyPageHandler());
$whoops->register();
function exceptionHandler($e)
{
//log the exception using monolog
}
function errorHandler($errno, $errstr, $errfile, $errline)
{
//log the error using monolog
}
set_error_handler("errorHandler");
set_exception_handler('exceptionHandler');
//Run Whoops #2 Location