LogbackLoggingConverter implements Converter<LoggingEvent> { ThrowableInfo initFromThrowableProxy(IThrowableProxy ti, boolean calculatePackagingData) { if(ti == null) { return null; } ThrowableInfo result = new ThrowableInfo(); result.setName(ti.getClassName()); result.setOmittedElements(ti.getCommonFrames()); result.setMessage(ti.getMessage()); result.setStackTrace(initFromStackTraceElementProxyArray(ti.getStackTraceElementProxyArray())); IThrowableProxy[] suppressedThrowableProxies = getSuppressed(ti); if(suppressedThrowableProxies != null) { ThrowableInfo[] suppressed = new ThrowableInfo[suppressedThrowableProxies.length]; for(int i=0;i<suppressedThrowableProxies.length;i++) { suppressed[i] = initFromThrowableProxy(suppressedThrowableProxies[i], calculatePackagingData); } result.setSuppressed(suppressed); } result.setCause(initFromThrowableProxy(ti.getCause(), calculatePackagingData)); return result; }  @Override LoggingEvent convert(Object o); @Override Class getSourceClass();  }
@Test public void testThrowableProxy() { Throwable t = produceThrowable(); ThrowableProxy ti = new ThrowableProxy(t); ti.calculatePackagingData(); ThrowableInfo tinfo = instance.initFromThrowableProxy(ti, true); assertEquals("yyy", tinfo.getMessage()); assertEquals("java.lang.RuntimeException: foo", tinfo.getCause().getMessage()); assertEquals("foo", tinfo.getCause().getCause().getMessage()); assertNull(tinfo.getCause().getCause().getCause()); }