@Test
public void testWithException() {

  try {
    throw new Exception("This is an exception");
  } catch (final Exception e) {
    final LoggingEvent event = createEventWithException("There was an exception", e);
    // Stack trace might change if the codebase changes, but this prefix should always remain the same
    assertTrue(this.layout.format(event)
        .startsWith("There was an exception\\njava.lang.Exception: This is an exception"));
  }
}