Java Code Examples for ch.qos.logback.classic.spi.IThrowableProxy#getMessage()

The following examples show how to use ch.qos.logback.classic.spi.IThrowableProxy#getMessage() . 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: 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 2
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 3
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 4
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 5
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 6
Source File: LoghubAppender.java    From aliyun-log-logback-appender with Apache License 2.0 4 votes vote down vote up
private String getExceptionInfo(IThrowableProxy iThrowableProxy) {
    String s = iThrowableProxy.getClassName();
    String message = iThrowableProxy.getMessage();
    return (message != null) ? (s + ": " + message) : s;
}
 
Example 7
Source File: ExpectedExceptionAppender.java    From centraldogma with Apache License 2.0 4 votes vote down vote up
private static boolean containsMessage(IThrowableProxy exception, String exceptionName) {
    final String message = exception.getMessage();
    return message != null && message.contains(exceptionAndMessage.get(exceptionName));
}