Erik P.
Member
I want to log server errors with new relic and am trying to extend the Xenforo_Error::logException method to do that however it doesn't appear that my extended error class is ever used. I've added so tracing code in the ::logException method but it doesn't get executed. Is it not possible to extend this class with the proxy system or it there some other way I should do this?
I have the code event listener for the load_class event thus:
Code:
class Rivals_Analytics_NewRelic_Error extends XFCP_Rivals_Analytics_NewRelic_Error
{
/**
* Log exceptions to New Relic as well as the server log
*/
public static function logException(Exception $e, $rollbackTransactions = true, $messagePrefix = '')
{
newrelic_notice_error($e->getMessage(), $e);
parent::logException($e, $rollbackTransactions, $messagePrefix);
}
}
I have the code event listener for the load_class event thus:
Code:
public static function loadClass($class, array &$extend)
{
switch ($class)
{
case 'XenForo_Error': // Exception and error reporting
$extend[] = 'Rivals_Analytics_NewRelic_Error';
break;
}
}