ch.qos.logback.classic.spi.IThrowableProxy Java Examples

The following examples show how to use ch.qos.logback.classic.spi.IThrowableProxy. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IntegrationPostHandler.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
private String parseException(ILoggingEvent eventObject2){
	if (eventObject.getThrowableProxy() != null) {
		StringBuilder sbException = new StringBuilder();
		IThrowableProxy throwableProxy = eventObject.getThrowableProxy();
		
		sbException.append("```\n");
		StackTraceElementProxy[] st = throwableProxy.getStackTraceElementProxyArray();
		for (int j = 0; j < st.length; j++) {
			StackTraceElementProxy stackTraceElementProxy = st[j];
			StackTraceElement stackTraceElement = stackTraceElementProxy.getStackTraceElement();
			sbException.append(stackTraceElement + "\n");
			if (j == 5) {
				break;
			}
		}
		sbException.append("```");
		return sbException.toString();
	}
	return null;
}
 
Example #2
Source File: LogFilter.java    From DimpleBlog with Apache License 2.0 6 votes vote down vote up
@Override
public FilterReply decide(ILoggingEvent event) {
    StringBuilder exception = new StringBuilder();
    IThrowableProxy iThrowableProxy1 = event.getThrowableProxy();
    if (iThrowableProxy1 != null) {
        exception.append("<span class='excehtext'>" + iThrowableProxy1.getClassName() + " " + iThrowableProxy1.getMessage() + "</span></br>");
        for (int i = 0; i < iThrowableProxy1.getStackTraceElementProxyArray().length; i++) {
            exception.append("<span class='excetext'>" + iThrowableProxy1.getStackTraceElementProxyArray()[i].toString() + "</span></br>");
        }
    }
    LoggerMessage loggerMessage = new LoggerMessage(
            event.getMessage()
            , DateFormat.getDateTimeInstance().format(new Date(event.getTimeStamp())),
            event.getThreadName(),
            event.getLoggerName(),
            event.getLevel().levelStr,
            exception.toString(),
            ""
    );
    LoggerQueue.getInstance().push(loggerMessage);
    return FilterReply.ACCEPT;
}
 
Example #3
Source File: DingTalkAppender.java    From jframework with Apache License 2.0 6 votes vote down vote up
private String transformStackTrace(ILoggingEvent event) {
    String exception = "";
    IThrowableProxy throwableProxy =  event.getThrowableProxy();
    if (throwableProxy != null) {
        exception = ThrowableProxyUtil.asString(throwableProxy);
    }

    StackTraceElement[] callerData = event.getCallerData();
    StackTraceElement stackTraceElement = callerData[0];

    String time = DEFAULT_DATE_FORMAT.format(new Date(event.getTimeStamp()));
    String threadName = event.getThreadName();
    String level = event.getLevel().toString();
    String logger = event.getLoggerName();
    String msg = event.getFormattedMessage();
    String className = stackTraceElement.getClassName();
    String method = stackTraceElement.getMethodName();
    int lineNumber = stackTraceElement.getLineNumber();

    return String.format(FORMAT_MESSAGE, time, threadName, level, logger, className, method, lineNumber, exception, msg);
}
 
Example #4
Source File: Gateway.java    From arcusplatform with Apache License 2.0 6 votes vote down vote up
@Override
public void appendLogEntry(ILoggingEvent event) {
   JsonObject object = new JsonObject();
   for(Map.Entry<String, String> e: event.getMDCPropertyMap().entrySet()) {
      object.addProperty(e.getKey(), e.getValue());
   }

   object.addProperty("ts", event.getTimeStamp());
   object.addProperty("lvl", event.getLevel().toString());
   object.addProperty("thd", event.getThreadName());
   object.addProperty("log", event.getLoggerName());
   object.addProperty("msg", event.getFormattedMessage());

   IThrowableProxy thrw = event.getThrowableProxy();
   if (thrw != null) {
      String stackTrace = converter.convert(event);
      object.addProperty("exc", stackTrace);
   } else {
      object.remove("exc");
   }

   if (!bufferedLogMessages.offer(object)) {
      log.trace("log message dropped because queue overflowed");
   }
}
 
Example #5
Source File: ErrorStatisticsAppender.java    From cachecloud with Apache License 2.0 6 votes vote down vote up
@Override
protected void append(ILoggingEvent event) {
    if (event == null) {
        return;
    }
    if (event.getLevel() == Level.ERROR || event.getLevel() == Level.WARN) {
        IThrowableProxy throwableProxy = event.getThrowableProxy();
        if (throwableProxy != null) {
        	//接口名
            String errorClassName = throwableProxy.getClassName();
            if (errorClassName != null && !"".equals(errorClassName.trim())) {
            	//写入AtomicLongMap并计数
                ERROR_NAME_VALUE_MAP.getAndIncrement(errorClassName);
            }
        }
    }
}
 
Example #6
Source File: ExceptionUtil.java    From cloudwatch-logback-appender with Apache License 2.0 6 votes vote down vote up
private static void appendProxy(StringBuilder sb, String aPrefix, String aHeader, IThrowableProxy aException) {

        sb.append(aPrefix + aHeader + aException.getClassName() + ": " +aException.getMessage() + "\n");

        String prefix = aPrefix+"\t";
        appendStackTrace(sb, prefix, aException);

        IThrowableProxy[] suppressed = aException.getSuppressed();
        if(suppressed!=null) {
            for(IThrowableProxy supp : suppressed) {
                if(supp!=null) {
                    appendProxy(sb, prefix, "Suppressed: ", supp);
                }
            }
        }

        IThrowableProxy cause = aException.getCause();
        if(cause!=null) {
            appendProxy(sb, prefix, "Causd by: ", cause);
        }
    }
 
Example #7
Source File: SpanLogsAppender.java    From java-spring-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * This is called only for configured levels.
 * It will not be executed for DEBUG level if root logger is INFO.
 */
@Override
protected void append(ILoggingEvent event) {
  Span span = tracer.activeSpan();
  if (span != null) {
    Map<String, Object> logs = new HashMap<>(6);
    logs.put("logger", event.getLoggerName());
    logs.put("level", event.getLevel().toString());
    logs.put("thread", event.getThreadName());
    logs.put("message", event.getFormattedMessage());

    if (Level.ERROR.equals(event.getLevel())) {
      logs.put("event", Tags.ERROR);
    }

    IThrowableProxy throwableProxy = event.getThrowableProxy();
    if (throwableProxy instanceof ThrowableProxy) {
      Throwable throwable = ((ThrowableProxy)throwableProxy).getThrowable();
      // String stackTrace = ThrowableProxyUtil.asString(throwableProxy);
      if (throwable != null) {
        logs.put("error.object", throwable);
      }
    }
    span.log(TimeUnit.MICROSECONDS.convert(event.getTimeStamp(), TimeUnit.MILLISECONDS), logs);
  }
}
 
Example #8
Source File: PrefixedThrowableProxyConverter.java    From bither-desktop-java with Apache License 2.0 6 votes vote down vote up
void subjoinThrowableProxy(StringBuilder buf, IThrowableProxy tp) {
    subjoinFirstLine(buf, tp);


    buf.append(CoreConstants.LINE_SEPARATOR);
    final StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
    final int commonFrames = tp.getCommonFrames();

    int maxIndex = stepArray.length;
    if (commonFrames > 0) {
        maxIndex -= commonFrames;
    }

    for (int i = 0; i < maxIndex; i++) {
        final String string = stepArray[i].toString();
        buf.append(PREFIX);
        buf.append(string);
        extraData(buf, stepArray[i]); // allow other data to be added
        buf.append(CoreConstants.LINE_SEPARATOR);
    }

    if (commonFrames > 0) {
        buf.append("!... ").append(tp.getCommonFrames()).append(
                " common frames omitted").append(CoreConstants.LINE_SEPARATOR);
    }
}
 
Example #9
Source File: StructuredLoggingEncoder.java    From flo with Apache License 2.0 6 votes vote down vote up
private static void writeStack(StringBuilder sb, IThrowableProxy t, String caption, int indent, String linebreak) {
  if (t == null) {
    return;
  }
  indent(sb, indent).append(caption).append(t.getClassName()).append(": ").append(t.getMessage()).append(linebreak);
  final StackTraceElementProxy[] trace = t.getStackTraceElementProxyArray();
  if (trace != null) {
    int commonFrames = t.getCommonFrames();
    int printFrames = trace.length - commonFrames;
    for (int i = 0; i < printFrames; i++) {
      indent(sb, indent).append("\t").append(trace[i]).append(linebreak);
    }
    if (commonFrames != 0) {
      indent(sb, indent).append("\t... ").append(commonFrames).append(" more").append(linebreak);
    }
    final IThrowableProxy[] suppressed = t.getSuppressed();
    for (IThrowableProxy st : suppressed) {
      writeStack(sb, st, "Suppressed: ", indent + 1, linebreak);
    }
  }

  writeStack(sb, t.getCause(), "Caused by: ", indent, linebreak);
}
 
Example #10
Source File: CollectorLogbackAppender.java    From glowroot with Apache License 2.0 6 votes vote down vote up
@Override
protected void append(ILoggingEvent event) {
    if (inFlush.get()) {
        return;
    }
    if (event.getLevel() == Level.DEBUG && event.getLoggerName().startsWith("io.grpc.")) {
        return;
    }
    if (event.getLoggerName().startsWith("org.glowroot.central.")
            || event.getLoggerName().startsWith("org.glowroot.ui.")) {
        // this can happen during integration tests when agent and the central collector are
        // running in the same JVM (using LocalContainer for agent)
        return;
    }
    LogEvent.Builder builder = LogEvent.newBuilder()
            .setTimestamp(event.getTimeStamp())
            .setLevel(toProto(event.getLevel()))
            .setLoggerName(event.getLoggerName())
            .setMessage(event.getFormattedMessage());
    IThrowableProxy throwable = event.getThrowableProxy();
    if (throwable != null) {
        builder.setThrowable(toProto(throwable));
    }
    flush(builder.build());
}
 
Example #11
Source File: CollectorLogbackAppender.java    From glowroot with Apache License 2.0 6 votes vote down vote up
private static Proto.Throwable toProto(IThrowableProxy t) {
    Proto.Throwable.Builder builder = Proto.Throwable.newBuilder()
            .setClassName(t.getClassName());
    String message = t.getMessage();
    if (message != null) {
        builder.setMessage(message);
    }
    for (StackTraceElementProxy element : t.getStackTraceElementProxyArray()) {
        builder.addStackTraceElement(ErrorMessage.toProto(element.getStackTraceElement()));
    }
    builder.setFramesInCommonWithEnclosing(t.getCommonFrames());
    IThrowableProxy cause = t.getCause();
    if (cause != null) {
        builder.setCause(toProto(cause));
    }
    for (IThrowableProxy suppressed : t.getSuppressed()) {
        builder.addSuppressed(toProto(suppressed));
    }
    return builder.build();
}
 
Example #12
Source File: PrefixedThrowableProxyConverter.java    From bither-desktop-java with Apache License 2.0 6 votes vote down vote up
void subjoinThrowableProxy(StringBuilder buf, IThrowableProxy tp) {
    subjoinFirstLine(buf, tp);


    buf.append(CoreConstants.LINE_SEPARATOR);
    final StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
    final int commonFrames = tp.getCommonFrames();

    int maxIndex = stepArray.length;
    if (commonFrames > 0) {
        maxIndex -= commonFrames;
    }

    for (int i = 0; i < maxIndex; i++) {
        final String string = stepArray[i].toString();
        buf.append(PREFIX);
        buf.append(string);
        extraData(buf, stepArray[i]); // allow other data to be added
        buf.append(CoreConstants.LINE_SEPARATOR);
    }

    if (commonFrames > 0) {
        buf.append("!... ").append(tp.getCommonFrames()).append(
                " common frames omitted").append(CoreConstants.LINE_SEPARATOR);
    }
}
 
Example #13
Source File: MillisecondPrecisionSyslogAppender.java    From logging-java with Apache License 2.0 6 votes vote down vote up
@Override
protected void postProcess(final Object eventObject, final OutputStream sw) {
  if (isThrowableExcluded()) {
    return;
  }

  final ILoggingEvent event = (ILoggingEvent) eventObject;
  final IThrowableProxy tp = event.getThrowableProxy();

  if (tp == null) {
    return;
  }

  final String stackTracePrefix = stackTraceLayout.doLayout(event);
  recursiveWrite(sw, stackTracePrefix, tp, 0, null);
}
 
Example #14
Source File: LoggingFilter.java    From NationStatesPlusPlus with MIT License 6 votes vote down vote up
@Override
public FilterReply decide(ILoggingEvent event) {
	final IThrowableProxy throwableProxy = event.getThrowableProxy();
	if (throwableProxy == null) {
		return FilterReply.NEUTRAL;
	}

	if (!(throwableProxy instanceof ThrowableProxy)) {
		return FilterReply.NEUTRAL;
	}

	final ThrowableProxy throwableProxyImpl = (ThrowableProxy) throwableProxy;
	final Throwable throwable = throwableProxyImpl.getThrowable();
	if (java.nio.channels.ClosedChannelException.class.isInstance(throwable)) {
		return FilterReply.DENY;
	}

	return FilterReply.NEUTRAL;
}
 
Example #15
Source File: LogWatcher.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
public static Predicate<ILoggingEvent> containsExceptionStackLine(final Class<?> clazz, final String methodName) {
    return event -> {
        IThrowableProxy throwable = (event != null) ? event.getThrowableProxy() : null;
        if (throwable != null) {
            for (StackTraceElementProxy line : throwable.getStackTraceElementProxyArray()) {
                if (line.getStackTraceElement().getClassName().contains(clazz.getSimpleName())
                        && line.getStackTraceElement().getMethodName().contains(methodName)) {
                    return true;
                }
            }
        }
        return false;
    };
}
 
Example #16
Source File: IrisLayout.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
@Override
public String doLayout(ILoggingEvent event) {
   if (!isJson) {
      return super.doLayout(event);
   }

   JsonObject object = new JsonObject();
   for(Map.Entry<String, String> e: event.getMDCPropertyMap().entrySet()) {
      object.addProperty(e.getKey(), e.getValue());
   }

   object.addProperty("ts", event.getTimeStamp());
   object.addProperty("sev", event.getLevel().toString());
   object.addProperty("host", IrisApplicationInfo.getHostName());
   if (IrisApplicationInfo.getContainerName() != null) {
      object.addProperty("ctn", IrisApplicationInfo.getContainerName());
   }
   object.addProperty("svc", IrisApplicationInfo.getApplicationName());
   object.addProperty("svr", IrisApplicationInfo.getApplicationVersion());
   object.addProperty("thd", event.getThreadName());
   object.addProperty("log", event.getLoggerName());
   object.addProperty("msg", event.getFormattedMessage());

   IThrowableProxy thrw = event.getThrowableProxy();
   if (thrw != null) {
      String stackTrace = converter.convert(event);
      object.addProperty("exc", stackTrace);
   } else {
      object.remove("exc");
   }

   String json = GSON.toJson(object);
   if (isJsonString) {
      json = GSON.toJson(json);
   }

   return json + "\n";
}
 
Example #17
Source File: RollbarAppender.java    From rollbar-java with MIT License 5 votes vote down vote up
@Override
protected void append(ILoggingEvent event) {
  if (event.getLoggerName() != null && event.getLoggerName().startsWith(PACKAGE_NAME)) {
    addWarn("Recursive logging");
    return;
  }

  IThrowableProxy throwableProxy = event.getThrowableProxy();
  ThrowableWrapper rollbarThrowableWrapper = buildRollbarThrowableWrapper(throwableProxy);
  Map<String, Object> custom = this.buildCustom(event);

  rollbar.log(rollbarThrowableWrapper, custom, event.getFormattedMessage(),
      Level.lookupByName(event.getLevel().levelStr), false);

}
 
Example #18
Source File: LogWatcher.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
public static Predicate<ILoggingEvent> containsExceptionClassname(final String expected) {
    return input -> {
        IThrowableProxy throwable = (input != null) ? input.getThrowableProxy() : null;
        String classname = (throwable != null) ? throwable.getClassName() : null;
        if (classname == null) return false;
        return classname.contains(expected);
    };
}
 
Example #19
Source File: RollbarAppender.java    From rollbar-java with MIT License 5 votes vote down vote up
private ThrowableWrapper buildRollbarThrowableWrapper(IThrowableProxy throwableProxy) {
  if (throwableProxy == null) {
    return null;
  }

  String className = throwableProxy.getClassName();
  String message = throwableProxy.getMessage();
  ThrowableWrapper causeThrowableWrapper =
      buildRollbarThrowableWrapper(throwableProxy.getCause());
  StackTraceElement[] stackTraceElements = buildStackTraceElements(
      throwableProxy.getStackTraceElementProxyArray());

  return new RollbarThrowableWrapper(className, message, stackTraceElements,
      causeThrowableWrapper);
}
 
Example #20
Source File: LogWatcher.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
public static Predicate<ILoggingEvent> containsExceptionMessages(final String... expecteds) {
    return input -> {
        IThrowableProxy throwable = (input != null) ? input.getThrowableProxy() : null;
        String msg = (throwable != null) ? throwable.getMessage() : null;
        if (msg == null) return false;
        for (String expected : expecteds) {
            if (!msg.contains(expected)) return false;
        }
        return true;
    };
}
 
Example #21
Source File: LogbackRecorder.java    From jhipster with Apache License 2.0 5 votes vote down vote up
Event(ILoggingEvent event) {
    this.marker = event.getMarker();
    this.level = event.getLevel().toString();
    this.message = event.getMessage();
    this.arguments = event.getArgumentArray();
    final IThrowableProxy proxy = event.getThrowableProxy();
    this.thrown = proxy == null ? null : proxy.getClassName() + ": " + proxy.getMessage();
}
 
Example #22
Source File: NSThrowableConvert.java    From ns4_frame with Apache License 2.0 5 votes vote down vote up
@Override
public void subjoinSTEPArray(StringBuilder buf, int indent, IThrowableProxy tp) {
    String totalKey = LogKey.getTotalKey();
    StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
    int commonFrames = tp.getCommonFrames();

    boolean unrestrictedPrinting = Integer.MAX_VALUE > stepArray.length;


    int maxIndex = (unrestrictedPrinting) ? stepArray.length : Integer.MAX_VALUE;
    if (commonFrames > 0 && unrestrictedPrinting) {
        maxIndex -= commonFrames;
    }

    for (int i = 0; i < maxIndex; i++) {
        buf.append(totalKey);
        ThrowableProxyUtil.indent(buf, indent);
        buf.append(stepArray[i]);
        extraData(buf, stepArray[i]); // allow other data to be added
        buf.append(CoreConstants.LINE_SEPARATOR);
    }

    if (commonFrames > 0 && unrestrictedPrinting) {
        buf.append(totalKey);
        ThrowableProxyUtil.indent(buf, indent);
        buf.append("... ").append(tp.getCommonFrames()).append(
                " common frames omitted").append(CoreConstants.LINE_SEPARATOR);
    }
}
 
Example #23
Source File: MetricsLogAppender.java    From pravega with Apache License 2.0 5 votes vote down vote up
private boolean shouldUnwrap(IThrowableProxy p) {
    // Most of our exceptions are wrapped in CompletionException or ExecutionException. Since these are not very useful
    // in terms of determining the root cause, we should unwrap them to get to the actual exception that caused the event.
    return p != null
            && p.getCause() != null
            && (p.getClassName().endsWith(COMPLETION_EXCEPTION_NAME) || p.getClassName().endsWith(EXECUTION_EXCEPTION_NAME));

}
 
Example #24
Source File: MetricsLogAppender.java    From pravega with Apache License 2.0 5 votes vote down vote up
private void recordEvent(String metricName, ILoggingEvent event) {
    IThrowableProxy p = event.getThrowableProxy();
    while (shouldUnwrap(p)) {
        p = p.getCause();
    }

    DYNAMIC_LOGGER.recordMeterEvents(metricName, 1, MetricsTags.exceptionTag(event.getLoggerName(), p == null ? null : p.getClassName()));
}
 
Example #25
Source File: PrefixedThrowableProxyConverter.java    From bither-desktop-java with Apache License 2.0 5 votes vote down vote up
@Override
protected String throwableProxyToString(IThrowableProxy tp) {
    final StringBuilder buf = new StringBuilder(32);
    IThrowableProxy currentThrowable = tp;
    while (currentThrowable != null) {
        subjoinThrowableProxy(buf, currentThrowable);
        currentThrowable = currentThrowable.getCause();
    }
    return buf.toString();
}
 
Example #26
Source File: LogbackStacktraceConverter.java    From cf-java-logging-support with Apache License 2.0 5 votes vote down vote up
@Override
public String convert(ILoggingEvent event) {
    StringBuilder appendTo = new StringBuilder();
    IThrowableProxy tProxy = event.getThrowableProxy();
    if (tProxy != null && ThrowableProxy.class.isAssignableFrom(tProxy.getClass())) {
        StacktraceConverter.CONVERTER.convert(((ThrowableProxy) tProxy).getThrowable(), appendTo);
        return appendTo.toString();
    }
    return null;
}
 
Example #27
Source File: EcsEncoder.java    From ecs-logging-java with Apache License 2.0 5 votes vote down vote up
@Override
public byte[] encode(ILoggingEvent event) {
    StringBuilder builder = new StringBuilder();
    EcsJsonSerializer.serializeObjectStart(builder, event.getTimeStamp());
    EcsJsonSerializer.serializeLogLevel(builder, event.getLevel().toString());
    EcsJsonSerializer.serializeFormattedMessage(builder, event.getFormattedMessage());
    serializeMarkers(event, builder);
    EcsJsonSerializer.serializeServiceName(builder, serviceName);
    EcsJsonSerializer.serializeEventDataset(builder, eventDataset);
    EcsJsonSerializer.serializeThreadName(builder, event.getThreadName());
    EcsJsonSerializer.serializeLoggerName(builder, event.getLoggerName());
    serializeAdditionalFields(builder);
    EcsJsonSerializer.serializeMDC(builder, event.getMDCPropertyMap());
    if (includeOrigin) {
        StackTraceElement[] callerData = event.getCallerData();
        if (callerData != null && callerData.length > 0) {
            EcsJsonSerializer.serializeOrigin(builder, callerData[0]);
        }
    }
    IThrowableProxy throwableProxy = event.getThrowableProxy();
    if (throwableProxy instanceof ThrowableProxy) {
        EcsJsonSerializer.serializeException(builder, ((ThrowableProxy) throwableProxy).getThrowable(), stackTraceAsArray);
    } else if (throwableProxy != null) {
        EcsJsonSerializer.serializeException(builder, throwableProxy.getClassName(), throwableProxy.getMessage(), throwableProxyConverter.convert(event), stackTraceAsArray);
    }
    EcsJsonSerializer.serializeObjectEnd(builder);
    // all these allocations kinda hurt
    return builder.toString().getBytes(UTF_8);
}
 
Example #28
Source File: GelfEncoder.java    From logback-gelf with GNU Lesser General Public License v2.1 5 votes vote down vote up
private IThrowableProxy getRootException(final IThrowableProxy throwableProxy) {
    if (throwableProxy == null) {
        return null;
    }

    IThrowableProxy rootCause = throwableProxy;
    while (rootCause.getCause() != null) {
        rootCause = rootCause.getCause();
    }

    return rootCause;
}
 
Example #29
Source File: DefaultLogThrowable.java    From twill with Apache License 2.0 5 votes vote down vote up
DefaultLogThrowable(IThrowableProxy throwableProxy) {
  this.className = throwableProxy.getClassName();
  this.message = throwableProxy.getMessage();

  StackTraceElementProxy[] stackTraceElementProxyArray = throwableProxy.getStackTraceElementProxyArray();
  this.stackTraces = new StackTraceElement[stackTraceElementProxyArray.length];
  for (int i = 0; i < stackTraceElementProxyArray.length; i++) {
    stackTraces[i] = stackTraceElementProxyArray[i].getStackTraceElement();
  }

  cause = (throwableProxy.getCause() == null) ? null : new DefaultLogThrowable(throwableProxy.getCause());
}
 
Example #30
Source File: GelfEncoder.java    From logback-gelf with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Map<String, Object> buildRootExceptionData(final IThrowableProxy throwableProxy) {
    final IThrowableProxy rootException = getRootException(throwableProxy);
    if (rootException == null) {
        return Collections.emptyMap();
    }

    final Map<String, Object> exceptionDataMap = new HashMap<>(2);
    exceptionDataMap.put("root_cause_class_name", rootException.getClassName());
    exceptionDataMap.put("root_cause_message", rootException.getMessage());

    return exceptionDataMap;
}