@Test public void renderExceptionWithCause() { Exception cause = new IOException("File not found"); Exception exception = new RuntimeException(cause); ExceptionToken token = new ExceptionToken(Collections.emptyList()); assertThat(render(token, exception)) .startsWith(RuntimeException.class.getName()) .contains(IOException.class.getName() + ": File not found") .contains(ExceptionTokenTest.class.getName(), "renderExceptionWithCause") .contains("... " + (cause.getStackTrace().length - 1) + " more") .hasLineCount(exception.getStackTrace().length + 4); }
@Override public void render(final LogEntry logEntry, final StringBuilder builder) { Throwable throwable = logEntry.getException(); if (throwable != null) { render(filter(throwable), Collections.<StackTraceElement>emptyList(), builder); } }
ExceptionToken implements Token { @Override public void render(final LogEntry logEntry, final StringBuilder builder) { Throwable throwable = logEntry.getException(); if (throwable != null) { render(filter(throwable), Collections.<StackTraceElement>emptyList(), builder); } } }
ExceptionToken implements Token { @Override public void render(final LogEntry logEntry, final StringBuilder builder) { Throwable throwable = logEntry.getException(); if (throwable != null) { render(filter(throwable), Collections.<StackTraceElement>emptyList(), builder); } } ExceptionToken(final List<ThrowableFilter> filters); }
ExceptionToken implements Token { @Override public void render(final LogEntry logEntry, final StringBuilder builder) { Throwable throwable = logEntry.getException(); if (throwable != null) { render(filter(throwable), Collections.<StackTraceElement>emptyList(), builder); } } ExceptionToken(final List<ThrowableFilter> filters); @Override Collection<LogEntryValue> getRequiredLogEntryValues(); @Override void render(final LogEntry logEntry, final StringBuilder builder); @Override void apply(final LogEntry logEntry, final PreparedStatement statement, final int index); }
ExceptionToken implements Token { @Override public void render(final LogEntry logEntry, final StringBuilder builder) { Throwable throwable = logEntry.getException(); if (throwable != null) { render(filter(throwable), Collections.<StackTraceElement>emptyList(), builder); } } ExceptionToken(final List<ThrowableFilter> filters); @Override Collection<LogEntryValue> getRequiredLogEntryValues(); @Override void render(final LogEntry logEntry, final StringBuilder builder); @Override void apply(final LogEntry logEntry, final PreparedStatement statement, final int index);  }