Java 类org.apache.logging.log4j.core.pattern.ThrowablePatternConverter 实例源码

项目:daikon    文件:Log4j2JSONLayout.java   
private void createStackTraceEvent(final LogEvent loggingEvent) {
    if (loggingEvent.getThrown().getStackTrace() != null) {
        final String[] options = { "full" };
        final ThrowablePatternConverter converter = ThrowablePatternConverter.newInstance(options);
        final StringBuilder sb = new StringBuilder();
        converter.format(loggingEvent, sb);
        final String stackTrace = sb.toString();
        addEventData(LayoutFields.STACK_TRACE, stackTrace);
    }
}