src/PhpProxyBuilder/Aop/Advice/ExceptionLoggingAdvice.php
public function interceptMethodCall(ProceedingJoinPointInterface $jointPoint) {
        try {
            return $jointPoint->proceed();
        } catch (Exception $e) {
            $methodName = $jointPoint->getMethodName();
            $partialTrace = array();
            $trace = $e->getTrace();
            $depth = 0;
            foreach ($trace as $entry) {
                if ($depth > $this->maxTraceDepth) {
                    $partialTrace[] = "... trace truncated";
                    break;
                }
                $file = isset($entry['file']) ? $entry['file'] : "";
                $function = isset($entry['function']) ? $entry['function'] : "";
                $line = isset($entry['line']) ? $entry['line'] : "";

                $partialTrace[] = sprintf("%s:%s:%s", $file, $function, $line);
                $depth++;
            }

            $msg = sprintf("Exception in %s:%s:%s (%d) %s", $e->getFile(), $e->getLine(), $methodName, $e->getCode(), $e->getMessage());
            $this->logger->logWarning($msg, implode("\n", $partialTrace));
            throw $e;
        }
    }
public function interceptMethodCall(ProceedingJoinPointInterface $jointPoint) {
        try {
            return $jointPoint->proceed();
        } catch (Exception $e) {
            $methodName = $jointPoint->getMethodName();
            $partialTrace = array();
            $trace = $e->getTrace();
            $depth = 0;
            foreach ($trace as $entry) {
                if ($depth > $this->maxTraceDepth) {
                    $partialTrace[] = "... trace truncated";
                    break;
                }
                $file = isset($entry['file']) ? $entry['file'] : "";
                $function = isset($entry['function']) ? $entry['function'] : "";
                $line = isset($entry['line']) ? $entry['line'] : "";

                $partialTrace[] = sprintf("%s:%s:%s", $file, $function, $line);
                $depth++;
            }

            $msg = sprintf("Exception in %s:%s:%s (%d) %s", $e->getFile(), $e->getLine(), $methodName, $e->getCode(), $e->getMessage());
            $this->logger->logWarning($msg, implode("\n", $partialTrace));
            throw $e;
        }
    }
public function interceptMethodCall ( ProceedingJoinPointInterface $ jointPoint ) { try { return $ jointPoint -> proceed ( ) ; } catch ( Exception $ e ) { $ methodName = $ jointPoint -> getMethodName ( ) ; $ partialTrace = array ( ) ; $ trace = $ e -> getTrace ( ) ; $ depth = 0 ; foreach ( $ trace as $ entry ) { if ( $ depth > $ this -> maxTraceDepth ) { $ partialTrace [ ] = "... trace truncated" ; break ; } $ file = isset ( $ entry [ 'file' ] ) ? $ entry [ 'file' ] : "" ; $ function = isset ( $ entry [ 'function' ] ) ? $ entry [ 'function' ] : "" ; $ line = isset ( $ entry [ 'line' ] ) ? $ entry [ 'line' ] : "" ; $ partialTrace [ ] = sprintf ( "%s:%s:%s" , $ file , $ function , $ line ) ; $ depth ++ ; } $ msg = sprintf ( "Exception in %s:%s:%s (%d) %s" , $ e -> getFile ( ) , $ e -> getLine ( ) , $ methodName , $ e -> getCode ( ) , $ e -> getMessage ( ) ) ; $ this -> logger -> logWarning ( $ msg , implode ( "\n" , $ partialTrace ) ) ; throw $ e ; } }
In this implementation we log each exception and rethrow.

@param ProceedingJoinPointInterface $jointPoint
@throws \Exception
@return mixed
In this implementation we log each exception and rethrow .