/** * Both things are logged with this method: the call of a method (joinPoint) * and the return value of this method. Constructors or method of type * 'void' are not recorded because the have no return value. * <p> * Because the given joinPoint cannot be used as key for a map in * {@link ObjectPlayer} it is saved as string. As a side effect this will * speedup the serialization stuff and shorten the generated record file. * </p> * * @param joinPoint * the joinpoint * @param returnValue * the return value */ @NullArgsAllowed public void log(final JoinPoint joinPoint, final Object returnValue) { String statement = JoinPointHelper.getAsLongString(joinPoint); try { save(statement, returnValue); } catch (IOException ioe) { LOG.debug("Logging to {} failed:", objStream, ioe); LOG.info("{} = {}", statement, returnValue); } }
private static void trace(final int level, final String prefix, final JoinPoint joinpoint, final String suffix) { if (LOG.isTraceEnabled()) { String loc = getLocation(joinpoint); LOG.trace(indent(level) + prefix + JoinPointHelper.getAsLongString(joinpoint) + suffix + loc); } else if (LOG.isDebugEnabled()) { LOG.debug(indent(level) + prefix + JoinPointHelper.getAsShortString(joinpoint) + suffix); } }
/** * Gets the return value for the given joinpoint. The return values are * returned in the same order as the were recorded. I.e. if for the same * joinpoint first the value "1" and then the value "2" is recorded you'll * get first "1", then "2" as the return value. * * @param joinPoint * the join point * @return the return value */ public Object getReturnValue(final JoinPoint joinPoint) { String statement = JoinPointHelper.getAsLongString(joinPoint); if (SignatureHelper.hasReturnType(joinPoint.getSignature())) { return getReturnValue(statement); } LOG.debug("REPLAY: {}", statement); return null; }
@NullArgsAllowed public void log(final JoinPoint joinPoint, final Object returnValue) { String statement = JoinPointHelper.getAsLongString(joinPoint); if ((returnValue != null) && (SignatureHelper.hasReturnType(joinPoint.getSignature()))) { try {