extending Xenforo_Error::logException

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?

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:

    public static function loadClass($class, array &$extend)
        switch ($class)
            case 'XenForo_Error':    // Exception and error reporting
                $extend[] = 'Rivals_Analytics_NewRelic_Error';


Well-known member
XenForo_Error isn't a class you can extend, I believe.

To be sure, create a listener with the hint 'XenForo_Error' and extend that, then it'll only call for XenForo_Error - if that doesn't work then it's not one of them. I wouldn't imagine it is, btw.

Chris D

XenForo developer
Staff member
Well, logException is a static method so none of the load_class methods will extend it because that event specifically fires when resolveDynamicClass is called on a class; and we only usually call that when we want to instantiate a class as an object, e.g.
$class = XenForo_Application::resolveDynamicClass($class);
$object = new $class();
So it's not really possible to extend that.