当前位置: 首页>>代码示例>>Java>>正文


Java IThrowableProxy.getCause方法代码示例

本文整理汇总了Java中ch.qos.logback.classic.spi.IThrowableProxy.getCause方法的典型用法代码示例。如果您正苦于以下问题:Java IThrowableProxy.getCause方法的具体用法?Java IThrowableProxy.getCause怎么用?Java IThrowableProxy.getCause使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ch.qos.logback.classic.spi.IThrowableProxy的用法示例。


在下文中一共展示了IThrowableProxy.getCause方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: appendThrowable

import ch.qos.logback.classic.spi.IThrowableProxy; //导入方法依赖的package包/类
private void appendThrowable(IThrowableProxy proxy, ILoggingEvent loggingEvent) {
    //Append Exception Message
    appendToLog(loggingEvent, String.format("%s: %s", proxy.getClassName(), proxy.getMessage()));
    //Append Exception Stack Trace
    for (StackTraceElementProxy element : loggingEvent.getThrowableProxy().getStackTraceElementProxyArray()) {
        appendToLog(loggingEvent, "\t" + element.getSTEAsString());
    }
    if (proxy.getSuppressed().length > 0) {
        appendToLog(loggingEvent, "Suppressed Exceptions:");
        for (IThrowableProxy p : proxy.getSuppressed()) {
            appendThrowable(p, loggingEvent);
        }
    }
    if (proxy.getCause() != null) {
        appendToLog(loggingEvent, "Cause:");
        appendThrowable(proxy.getCause(), loggingEvent);
    }
}
 
开发者ID:StuPro-TOSCAna,项目名称:TOSCAna,代码行数:19,代码来源:MemoryAppender.java

示例2: recursiveAppendRootCauseFirst

import ch.qos.logback.classic.spi.IThrowableProxy; //导入方法依赖的package包/类
protected void recursiveAppendRootCauseFirst(StringBuilder sb, String prefix, int indent, IThrowableProxy tp) {
  if (tp.getCause() != null) {
    recursiveAppendRootCauseFirst(sb, prefix, indent, tp.getCause());
    prefix = null; // to avoid adding it more than once
  }
  ThrowableProxyUtil.indent(sb, indent - 1);
  if (prefix != null) {
    sb.append(prefix);
  }
  ThrowableProxyUtil.subjoinFirstLineRootCauseFirst(sb, tp);
  sb.append(CoreConstants.LINE_SEPARATOR);
  subjoinSTEPArray(sb, indent, tp);
  IThrowableProxy[] suppressed = tp.getSuppressed();
  if(suppressed != null) {
    for(IThrowableProxy current : suppressed) {
      recursiveAppendRootCauseFirst(sb, CoreConstants.SUPPRESSED, indent + ThrowableProxyUtil.SUPPRESSED_EXCEPTION_INDENT, current);
    }
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:20,代码来源:RootCauseFirstThrowableProxyConverter.java

示例3: buildCausalString

import ch.qos.logback.classic.spi.IThrowableProxy; //导入方法依赖的package包/类
/**
 * Builds an exception causation string by following the exception caused-by chain.
 * @param exception The exception to process.
 * @return A string describing all exceptions in the chain.
 */
private static String buildCausalString(IThrowableProxy exception)
{
  final StringBuilder buff = new StringBuilder();

  buff.append(exception.getClassName());
  if (exception.getMessage() != null)
  {
    buff.append(": ").append(exception.getMessage());
  }

  if (exception.getCause() != null)
  {
    buff.append("; caused by: ").append(buildCausalString(exception.getCause()));
  }

  return buff.toString();
}
 
开发者ID:gkopff,项目名称:logback-raygun,代码行数:23,代码来源:RaygunAppender.java

示例4: createThrowableData

import ch.qos.logback.classic.spi.IThrowableProxy; //导入方法依赖的package包/类
/**
 * fluentdサーバに転送するログデータに格納する例外情報を生成する。
 * 
 * @param th 例外データ。
 * @return 例外情報。
 */
private Map<String, Object> createThrowableData(IThrowableProxy th) {

	Map<String, Object> data = new LinkedHashMap<>();
	data.put("className", th.getClassName());
	data.put("message", th.getMessage());

	List<String> stackTrace = new ArrayList<>();
	for (StackTraceElementProxy ste : th.getStackTraceElementProxyArray()) {
		stackTrace.add(ste.toString());
	}
	data.put("stackTrace", stackTrace);

	if (th.getCause() != null) {
		data.put("cause", createThrowableData(th.getCause()));
	}

	return data;
}
 
开发者ID:agwlvssainokuni,项目名称:sqlapp,代码行数:25,代码来源:FluentLoggerAppender.java

示例5: toProto

import ch.qos.logback.classic.spi.IThrowableProxy; //导入方法依赖的package包/类
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();
}
 
开发者ID:glowroot,项目名称:glowroot,代码行数:21,代码来源:CollectorLogbackAppender.java

示例6: getException

import ch.qos.logback.classic.spi.IThrowableProxy; //导入方法依赖的package包/类
private IThrowableProxy getException(ILoggingEvent event) {
    final IThrowableProxy throwableProxy = event.getThrowableProxy();
    if (throwableProxy != null) {
        final IThrowableProxy cause = throwableProxy.getCause();
        if (cause != null) {
            return cause;
        }
    }
    return null;
}
 
开发者ID:line,项目名称:centraldogma,代码行数:11,代码来源:ExpectedExceptionAppender.java

示例7: render

import ch.qos.logback.classic.spi.IThrowableProxy; //导入方法依赖的package包/类
public void render(StringBuilder sbuf, ILoggingEvent event) {
    IThrowableProxy tp = event.getThrowableProxy();
    while (tp != null) {
        render(sbuf, tp);
        tp = tp.getCause();
    }
}
 
开发者ID:zhaoqilong3031,项目名称:spring-cloud-samples,代码行数:8,代码来源:DefaultThrowableRenderer.java

示例8: append

import ch.qos.logback.classic.spi.IThrowableProxy; //导入方法依赖的package包/类
@Override
protected void append(ILoggingEvent event) {
    StringBuilder message = new StringBuilder(event.getFormattedMessage());
    IThrowableProxy throwableProxy = event.getThrowableProxy();
    while (throwableProxy != null) {
        message.append("\n").append(dump(throwableProxy));
        throwableProxy = throwableProxy.getCause();
        if (throwableProxy != null) {
            message.append("\nCaused by:");
        }
    }

    String account = event.getMDCPropertyMap().get(CloudwatchLogsMDCPropertyNames.ACCOUNT);
    String action = event.getMDCPropertyMap().get(CloudwatchLogsMDCPropertyNames.ACTION);
    String user = event.getMDCPropertyMap().get(CloudwatchLogsMDCPropertyNames.USER);
    String session = event.getMDCPropertyMap().get(CloudwatchLogsMDCPropertyNames.SESSION);
    String request = event.getMDCPropertyMap().get(CloudwatchLogsMDCPropertyNames.REQUEST);

    Marker marker = event.getMarker();
    String eventId = marker == null ? null : marker.getName();

    CloudwatchLogsLogEvent logEvent = new CloudwatchLogsLogEvent(event.getLevel().toString(), event.getLoggerName(), eventId, message.toString(), event.getTimeStamp(), event.getThreadName(), account, action, user, session, request);
    while (!eventQueue.offer(logEvent)) {
        // Discard old logging messages while queue is full.
        eventQueue.poll();
        discardedCount.incrementAndGet();
    }
    processedCount.incrementAndGet();
}
 
开发者ID:boxfuse,项目名称:cloudwatchlogs-java-appender,代码行数:30,代码来源:CloudwatchLogsLogbackAppender.java

示例9: DefaultLogThrowable

import ch.qos.logback.classic.spi.IThrowableProxy; //导入方法依赖的package包/类
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());
}
 
开发者ID:apache,项目名称:twill,代码行数:13,代码来源:DefaultLogThrowable.java

示例10: getRootException

import ch.qos.logback.classic.spi.IThrowableProxy; //导入方法依赖的package包/类
private IThrowableProxy getRootException(final IThrowableProxy throwableProxy) {
    if (throwableProxy == null) {
        return null;
    }

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

    return rootCause;
}
 
开发者ID:osiegmar,项目名称:logback-gelf,代码行数:13,代码来源:GelfLayout.java

示例11: postProcess

import ch.qos.logback.classic.spi.IThrowableProxy; //导入方法依赖的package包/类
@Override
protected void postProcess(Object eventObject, OutputStream sw) {
  if (throwableExcluded)
    return;

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

  if (tp == null)
    return;

  String stackTracePrefix = stackTraceLayout.doLayout(event);
  boolean isRootException = true;
  while (tp != null) {
    StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
    try {
      handleThrowableFirstLine(sw, tp, stackTracePrefix, isRootException);
      isRootException = false;
      for (StackTraceElementProxy step : stepArray) {
        StringBuilder sb = new StringBuilder();
        sb.append(stackTracePrefix).append(step);
        sw.write(sb.toString().getBytes());
        sw.flush();
      }
    } catch (IOException e) {
      break;
    }
    tp = tp.getCause();
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:31,代码来源:SyslogAppender.java

示例12: render

import ch.qos.logback.classic.spi.IThrowableProxy; //导入方法依赖的package包/类
public void render(StringBuilder sbuf, ILoggingEvent event) {
  IThrowableProxy tp = event.getThrowableProxy();
  sbuf.append("<tr><td class=\"Exception\" colspan=\"6\">");
  while (tp != null) {
    render(sbuf, tp);
    tp = tp.getCause();
  }
  sbuf.append("</td></tr>");
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:10,代码来源:DefaultThrowableRenderer.java

示例13: throwableProxyToString

import ch.qos.logback.classic.spi.IThrowableProxy; //导入方法依赖的package包/类
@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();
}
 
开发者ID:bither,项目名称:bither-desktop-java,代码行数:11,代码来源:PrefixedThrowableProxyConverter.java

示例14: addExceptionsRecursively

import ch.qos.logback.classic.spi.IThrowableProxy; //导入方法依赖的package包/类
private void addExceptionsRecursively(final IThrowableProxy throwableProxy, final List<ExceptionVO> exceptions) {
    final ExceptionVO exception = new ExceptionVO();
    exception.setErrorClass(throwableProxy.getClassName());
    exception.setMessage(throwableProxy.getMessage());
    exception.addStackTrace(convertToStackTraces(throwableProxy));
    exceptions.add(exception);

    final boolean hasCause = throwableProxy.getCause() != null;
    if (hasCause) {
        addExceptionsRecursively(throwableProxy.getCause(), exceptions);
    }
}
 
开发者ID:codereligion,项目名称:bugsnag-logback,代码行数:13,代码来源:Converter.java

示例15: postProcess

import ch.qos.logback.classic.spi.IThrowableProxy; //导入方法依赖的package包/类
@Override
protected void postProcess(final Object eventObject, final OutputStream sw) {
    if (isThrowableExcluded()) {
        return;
    }

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

    if (tp == null) {
        return;
    }

    final String stackTracePrefix = stackTraceLayout.doLayout(event);
    boolean isRootException = true;
    while (tp != null) {
        final StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
        try {
            handleThrowableFirstLine(sw, tp, stackTracePrefix, isRootException);
            isRootException = false;
            for (final StackTraceElementProxy step : stepArray) {
                final StringBuilder sb = new StringBuilder();
                sb.append(stackTracePrefix).append(step);
                sw.write(sb.toString().getBytes());
                sw.flush();
            }
        } catch (IOException e) {
            break;
        }
        tp = tp.getCause();
    }
}
 
开发者ID:RWTH-i5-IDSG,项目名称:BikeMan,代码行数:33,代码来源:MillisecondPrecisionSyslogAppender.java


注:本文中的ch.qos.logback.classic.spi.IThrowableProxy.getCause方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。