I am trying to using Monolog in the set_exception_handler
and set_error_handler
, while Whoops outside.
I tried 2 locations for running Whoops.
Run Whoops #1 Location
- Result: Monolog logs the error/exception and Whoops doesn't display
Run Whoops #2 Location
- Result: Monolog doesn't log anything and Whoops displays
I am stuck on why I am not able to get both Monolog and Whoops to work together.
...
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