Usually monolog takes care of this, which works fine in the Symfony application. Sadly I do not have Symfony started in this context (and doing so would be overkill), so I don’t have access to the actual monolog configuration. I basically set the exception in the context array, so I can access it and process it some way. How would I configure setting the exception as such? I feel like this is trivial to add, but must’ve missed it in the documentation.
I feel like there’s something to add to this piece of code, perhaps try and add the monolog processor for this manually? Thanks for pointing me in the right direction already!
self::$logger = new \Monolog\Logger($name);
self::$logger->pushProcessor(function ($record) {
// ...
$trace = \Logger::getStackTrace();
$record['stacktrace'] = ['frames' => Raven_Stacktrace::get_stack_info($trace)];
$record['context']['stacktrace'] = $record['stacktrace'];
return $record;
});
if (defined('SENTRY_DSN')) {
$client = new \Raven_Client(SENTRY_DSN, array('curl_method' => 'exec'));
$handler = new RavenLoggerWithStacktraceHandler($client, \Monolog\Logger::WARNING);
$handler->setFormatter(new LineFormatter("%message% %context% %extra%\n"));
self::$logger->pushHandler($handler);
}