ExceptionArgumentsProvider extends AbstractFieldJsonProvider<ILoggingEvent> { @Override public void writeTo(JsonGenerator generator, ILoggingEvent event) throws IOException { writeExceptionIfNecessary(generator, event.getThrowableProxy()); }  @Override void writeTo(JsonGenerator generator, ILoggingEvent event);  }
@Test public void testProvider() throws IOException { LoggerContext context = new LoggerContext(); context.getStatusManager().add(new OnConsoleStatusListener()); createExceptionMappingRegistry(context); StringWriter writer = new StringWriter(); JsonGenerator g = mkJsonGenerator(writer); ExceptionArgumentsProvider provider = new ExceptionArgumentsProvider(); provider.setContext(context); provider.setFieldName("exception"); provider.start(); ILoggingEvent event = mkLoggingEvent(context); g.writeStartObject(); provider.writeTo(g, event); g.writeEndObject(); g.flush(); g.close(); String s = writer.toString(); assertThat(s) .isEqualTo( "{\"exception\":[{\"name\":\"java.lang.RuntimeException\",\"properties\":{\"message\":\"derp\"}}]}"); }