public void afterReturning( final Object returnValue, final Method method, final Object[] args, final Object target ) throws Throwable { Log logger = LogFactory.getLog( target.getClass() ); if ( logger.isDebugEnabled() ) { logger.debug( Messages.getInstance().getString( "LoggingInterceptor.DEBUG_END_METHOD" ) ); //$NON-NLS-1$ log( method, args, target ); logger.debug( Messages.getInstance().getString( "LoggingInterceptor.DEBUG_RETURN_VALUE", returnValue.getClass().getName(), toString( returnValue ) ) ); //$NON-NLS-1$ } }
private void log( final Method method, final Object[] args, final Object target ) { Log logger = LogFactory.getLog( target.getClass() ); if ( logger.isDebugEnabled() ) { logger.debug( Messages.getInstance().getString( "LoggingInterceptor.DEBUG_METHOD_NAME", method.getName() ) ); //$NON-NLS-1$ logger.debug( Messages.getInstance().getString( "LoggingInterceptor.DEBUG_TARGET_OBJECT", target.getClass().getName(), toString( target ) ) ); //$NON-NLS-1$ logger.debug( Messages.getInstance().getString( "LoggingInterceptor.DEBUG_METHOD_ARGS", arrayToString( args ) ) ); //$NON-NLS-1$ } }
public void before( final Method method, final Object[] args, final Object target ) throws Throwable { Log logger = LogFactory.getLog( target.getClass() ); if ( logger.isDebugEnabled() ) { logger.debug( Messages.getInstance().getString( "LoggingInterceptor.DEBUG_BEGIN_METHOD" ) ); //$NON-NLS-1$ log( method, args, target ); } }
/** * Returns a string representation of the given array. Instead of overriding this method, try overriding * <code>toString(object)</code> instead. */ protected String arrayToString( final Object[] objects ) { StringBuffer buf = new StringBuffer(); if ( null == objects ) { return "null"; //$NON-NLS-1$ } else { for ( int i = 0; i < objects.length; i++ ) { if ( i > 0 ) { buf.append( ", " ); //$NON-NLS-1$ } buf.append( toString( objects[i] ) ); } return buf.toString(); } }
public void afterThrowing( final Method method, final Object[] args, final Object target, final Throwable exception ) { Log logger = LogFactory.getLog( target.getClass() ); if ( logger.isDebugEnabled() ) { logger.debug( Messages.getInstance().getString( "LoggingInterceptor.DEBUG_EXCEPTION_IN_METHOD" ) ); //$NON-NLS-1$ log( method, args, target ); logger.debug( Messages.getInstance().getString( "LoggingInterceptor.DEBUG_EXCEPTION", exception.getClass().getName(), exception.getMessage() ) ); //$NON-NLS-1$ logger.debug( Messages.getInstance().getString( "LoggingInterceptor.DEBUG_STACK_TRACE" ), exception ); //$NON-NLS-1$ } }