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

The following examples show how to use ch.qos.logback.classic.spi.IThrowableProxy#getClassName() . 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: 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 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> 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 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;
}