LogbackLoggingConverter implements Converter<LoggingEvent> { @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") private ExtendedStackTraceElement[] convert(StackTraceElement[] stackTrace) { if(stackTrace == null) { return null; } ExtendedStackTraceElement[] result = new ExtendedStackTraceElement[stackTrace.length]; for(int i = 0; i < stackTrace.length; i++) { result[i] = new ExtendedStackTraceElement(stackTrace[i]); } return result; }  @Override LoggingEvent convert(Object o); @Override Class getSourceClass();  }
@Test public void testConvertEvent() { @SuppressWarnings({"ThrowableResultOfMethodCallIgnored"}) ch.qos.logback.classic.spi.LoggingEvent logbackEvent = new ch.qos.logback.classic.spi.LoggingEvent( "de.huxhorn.lilith.data.logging.logback.LogbackLoggingConverterTest", (ch.qos.logback.classic.Logger) logger, Level.INFO, "Message", produceThrowable(), new String[]{"First", null, "Third"} ); LoggingEvent lilithEvent = instance.convert(logbackEvent); if(logger.isInfoEnabled()) logger.info("lilithEvent: {}", lilithEvent); prettyPrint(lilithEvent); }