當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。