@Test public void testWithThrown() { Throwable cause = new Throwable("Goodbye World"); LogData data = FakeLogData.withPrintfStyle("Hello World").addMetadata(LogContext.Key.LOG_CAUSE, cause); SimpleLogEvent logEvent = newSimpleLogEvent(data); assertThat(logEvent.asLoggingEvent().getThrowableInformation().getThrowable()) .isSameInstanceAs(cause); }
LoggingEvent asLoggingEvent() { String fqnOfCategoryClass = null; String nestedDiagnosticContext = ""; Map<String, String> mdcProperties = Collections.emptyMap(); return new LoggingEvent( fqnOfCategoryClass, logger, TimeUnit.NANOSECONDS.toMillis(logData.getTimestampNanos()), level, message, Thread.currentThread().getName(), thrown != null ? new ThrowableInformation(thrown) : null, nestedDiagnosticContext, getLocationInfo(), mdcProperties); }
SimpleLogEvent implements SimpleLogHandler { LoggingEvent asLoggingEvent() { String fqnOfCategoryClass = null; String nestedDiagnosticContext = ""; Map<String, String> mdcProperties = Collections.emptyMap(); return new LoggingEvent( fqnOfCategoryClass, logger, TimeUnit.NANOSECONDS.toMillis(logData.getTimestampNanos()), level, message, Thread.currentThread().getName(), thrown != null ? new ThrowableInformation(thrown) : null, nestedDiagnosticContext, getLocationInfo(), mdcProperties); } }
SimpleLogEvent implements SimpleLogHandler { LoggingEvent asLoggingEvent() { String fqnOfCategoryClass = null; String nestedDiagnosticContext = ""; Map<String, String> mdcProperties = Collections.emptyMap(); return new LoggingEvent( fqnOfCategoryClass, logger, TimeUnit.NANOSECONDS.toMillis(logData.getTimestampNanos()), level, message, Thread.currentThread().getName(), thrown != null ? new ThrowableInformation(thrown) : null, nestedDiagnosticContext, getLocationInfo(), mdcProperties); } private  SimpleLogEvent(Logger logger, LogData logData); private  SimpleLogEvent(Logger logger, RuntimeException error, LogData badLogData); }
SimpleLogEvent implements SimpleLogHandler { LoggingEvent asLoggingEvent() { String fqnOfCategoryClass = null; String nestedDiagnosticContext = ""; Map<String, String> mdcProperties = Collections.emptyMap(); return new LoggingEvent( fqnOfCategoryClass, logger, TimeUnit.NANOSECONDS.toMillis(logData.getTimestampNanos()), level, message, Thread.currentThread().getName(), thrown != null ? new ThrowableInformation(thrown) : null, nestedDiagnosticContext, getLocationInfo(), mdcProperties); } private  SimpleLogEvent(Logger logger, LogData logData); private  SimpleLogEvent(Logger logger, RuntimeException error, LogData badLogData); @Override void handleFormattedLogMessage(
      java.util.logging.Level level, String message, Throwable thrown); @Override String toString(); }
SimpleLogEvent implements SimpleLogHandler { LoggingEvent asLoggingEvent() { String fqnOfCategoryClass = null; String nestedDiagnosticContext = ""; Map<String, String> mdcProperties = Collections.emptyMap(); return new LoggingEvent( fqnOfCategoryClass, logger, TimeUnit.NANOSECONDS.toMillis(logData.getTimestampNanos()), level, message, Thread.currentThread().getName(), thrown != null ? new ThrowableInformation(thrown) : null, nestedDiagnosticContext, getLocationInfo(), mdcProperties); } private  SimpleLogEvent(Logger logger, LogData logData); private  SimpleLogEvent(Logger logger, RuntimeException error, LogData badLogData); @Override void handleFormattedLogMessage(
      java.util.logging.Level level, String message, Throwable thrown); @Override String toString();  }