@Override
    @SuppressWarnings("nls")
    public void apply(final ApiRequest request, final IPolicyContext context, final Object config,
            final IPolicyChain<ApiRequest> chain) {
        // This is just for testing, don't do this at home, kids.
        // Depending how you run the tests, the logger may already have been resolved so it will fail.
        // To combat this, we set the delegate manually here.
        ApimanLoggerFactory.setDelegate(new LogTestDelegateFactory());
        TestLogger logger = (TestLogger) context.getLogger(getClass());
        logger.setHeaders(request.getHeaders());
        // These messages are written as headers into request.getHeaders(), so we can assert against them
        // via the REST test suite. 
        logger.info("Hello, I am an info message");
        logger.debug("Hello, I am a debug message");
        logger.warn("Hello, I am a warn message");
        logger.trace("Hello, I am a trace message");
        logger.error("Hello, I am an error message", new RuntimeException("An example of an error"));
        logger.error(new RuntimeException("Just the exception"));
        chain.doApply(request);
    }
@see io.apiman.gateway.engine.policy.IPolicy#apply(io.apiman.gateway.engine.beans.ApiRequest, io.apiman.gateway.engine.policy.IPolicyContext, java.lang.Object, io.apiman.gateway.engine.policy.IPolicyChain)
gateway/test/src/test/java/io/apiman/gateway/test/policies/LoggingPolicy.java