【发布时间】:2019-12-24 19:54:56
【问题描述】:
我正在尝试在 set_exception_handler 和 set_error_handler 中使用 Monolog,而在外面哎呀。
我尝试了 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
【问题讨论】:
标签: php exception monolog whoops