Java 类ch.qos.logback.classic.spi.StackTraceElementProxy 实例源码

项目:playorm    文件:CassandraAppender.java   
public String fullDump(ILoggingEvent evt) {
    try {
        IThrowableProxy proxy = evt.getThrowableProxy();
        if(proxy == null)
            return null;

        StringBuilder builder = new StringBuilder();
        for (StackTraceElementProxy step : proxy
                .getStackTraceElementProxyArray()) {
            String string = step.toString();
            builder.append(CoreConstants.TAB).append(string);
            ThrowableProxyUtil.subjoinPackagingData(builder, step);
            builder.append(CoreConstants.LINE_SEPARATOR);
        }
        return builder.toString();
    } catch(Exception e) {
        addError("exception trying to log exception", e);
        return "exception parsing exception";
    }
}
项目:TOSCAna    文件:MemoryAppender.java   
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);
    }
}
项目:java-logging    文件:ReformLoggingLayout.java   
private void appendStackTrace(StringBuilder log, ThrowableProxy proxy) {
    if (proxy != null) {
        Stream<StackTraceElementProxy> trace = Arrays.stream(proxy.getStackTraceElementProxyArray());

        trace.forEach(step -> {
            String string = step.toString();

            log.append(CoreConstants.TAB).append(string);

            ThrowableProxyUtil.subjoinPackagingData(log, step);

            log.append(CoreConstants.LINE_SEPARATOR);
        });

        trace.close();
    }
}
项目:spring-cloud-samples    文件:DefaultThrowableRenderer.java   
void render(StringBuilder sbuf, IThrowableProxy tp) {
    printFirstLine(sbuf, tp);

    int commonFrames = tp.getCommonFrames();
    StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();

    for (int i = 0; i < stepArray.length - commonFrames; i++) {
        StackTraceElementProxy step = stepArray[i];
        sbuf.append(TRACE_PREFIX);
        sbuf.append(Transform.escapeTags(step.toString()));
        sbuf.append(CoreConstants.LINE_SEPARATOR);
    }

    if (commonFrames > 0) {
        sbuf.append(TRACE_PREFIX);
        sbuf.append("\t... ").append(commonFrames).append(" common frames omitted").append(CoreConstants.LINE_SEPARATOR);
    }
}
项目:tip    文件:LoggingInfo.java   
public static LoggingInfo build(LoggingEvent loggingEvent) {
    LoggingInfo loggingInfo = new LoggingInfo();
    if (null != loggingEvent) {
        loggingInfo.setMessage(loggingEvent.getMessage());
        loggingInfo.setLevel(loggingEvent.getLevel().toString());
        loggingInfo.setLoggerName(loggingEvent.getLoggerName());
        loggingInfo.setThreadName(loggingEvent.getThreadName());
        if (null != loggingEvent.getThrowableProxy()) {
            loggingInfo.setExceptionName(loggingEvent.getThrowableProxy().getClassName());
            loggingInfo.setExceptionMessage(loggingEvent.getThrowableProxy().getMessage());
            StackTraceElementProxy[] stackTraces = loggingEvent.getThrowableProxy().getStackTraceElementProxyArray();
            if (null != stackTraces && stackTraces.length > 0) {
                loggingInfo.setTopStackTrace(stackTraces[0].getStackTraceElement().toString());
            }
        }
        if (loggingEvent.hasCallerData()) {
            StackTraceElement st = loggingEvent.getCallerData()[0];
            loggingInfo.setCallerData(st.toString());
        }
        loggingInfo.setMdcProperty(loggingEvent.getMDCPropertyMap());
        loggingInfo.setCreateTime(millisecondToDateTime(loggingEvent.getTimeStamp()));
    }
    return loggingInfo;
}
项目:bartleby    文件:DefaultThrowableRenderer.java   
void render(StringBuilder sbuf, IThrowableProxy tp) {
  printFirstLine(sbuf, tp);

  int commonFrames = tp.getCommonFrames();
  StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();

  for (int i = 0; i < stepArray.length - commonFrames; i++) {
    StackTraceElementProxy step = stepArray[i];
    sbuf.append(TRACE_PREFIX);
    sbuf.append(Transform.escapeTags(step.toString()));
    sbuf.append(CoreConstants.LINE_SEPARATOR);
  }

  if (commonFrames > 0) {
    sbuf.append(TRACE_PREFIX);
    sbuf.append("\t... ").append(commonFrames).append(" common frames omitted")
        .append(CoreConstants.LINE_SEPARATOR);
  }
}
项目:bartleby    文件:HTMLLayoutTest.java   
@Test
public void testAppendThrowable() throws Exception {
  StringBuilder buf = new StringBuilder();
  DummyThrowableProxy tp = new DummyThrowableProxy();
  tp.setClassName("test1");
  tp.setMessage("msg1");

  StackTraceElement ste1 = new StackTraceElement("c1", "m1", "f1", 1);
  StackTraceElement ste2 = new StackTraceElement("c2", "m2", "f2", 2);

  StackTraceElementProxy[] stepArray = { new StackTraceElementProxy(ste1),
      new StackTraceElementProxy(ste2) };
  tp.setStackTraceElementProxyArray(stepArray);
  DefaultThrowableRenderer renderer = (DefaultThrowableRenderer) layout
      .getThrowableRenderer();

  renderer.render(buf, tp);
  System.out.println(buf.toString());
  String[] result = buf.toString().split(CoreConstants.LINE_SEPARATOR);
  System.out.println(result[0]);
  assertEquals("test1: msg1", result[0]);
  assertEquals(DefaultThrowableRenderer.TRACE_PREFIX + "at c1.m1(f1:1)", result[1]);
}
项目:bither-desktop-java    文件:PrefixedThrowableProxyConverter.java   
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);
    }
}
项目:bugsnag-logback    文件:Converter.java   
private List<StackTraceVO> convertToStackTraces(final IThrowableProxy throwableProxy) {
    final StackTraceElementProxy[] stackTraceElementProxies = throwableProxy.getStackTraceElementProxyArray();
    final List<StackTraceVO> stackTraces = Lists.newArrayList();

    for (final StackTraceElementProxy stackTraceElementProxy : stackTraceElementProxies) {
        final StackTraceElement stackTraceElement = stackTraceElementProxy.getStackTraceElement();

        final StackTraceVO stackTrace = new StackTraceVO();
        stackTrace.setMethod(stackTraceElement.getClassName() + "." + stackTraceElement.getMethodName());
        stackTrace.setLineNumber(stackTraceElement.getLineNumber());
        stackTrace.setFile(stackTraceElement.getFileName());
        stackTrace.setInProject(configuration.isInProject(stackTraceElement.getClassName()));

        stackTraces.add(stackTrace);
    }

    return stackTraces;
}
项目:sqlapp    文件:FluentLoggerAppender.java   
/**
 * 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;
}
项目:glowroot    文件:CollectorLogbackAppender.java   
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();
}
项目:springapp    文件:FluentLoggerAppender.java   
/**
 * 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;
}
项目:bither-desktop-java    文件:PrefixedThrowableProxyConverter.java   
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);
    }
}
项目:grails-lightweight-deploy    文件:PrefixedThrowableProxyConverter.java   
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);
    }
}
项目:aliyun-log-logback-appender    文件:LoghubAppender.java   
private String fullDump(StackTraceElementProxy[] stackTraceElementProxyArray) {
    StringBuilder builder = new StringBuilder();
    for (StackTraceElementProxy step : stackTraceElementProxyArray) {
        builder.append(CoreConstants.LINE_SEPARATOR);
        String string = step.toString();
        builder.append(CoreConstants.TAB).append(string);
        ThrowableProxyUtil.subjoinPackagingData(builder, step);
    }
    return builder.toString();
}
项目:cloudwatchlogs-java-appender    文件:CloudwatchLogsLogbackAppender.java   
private String dump(IThrowableProxy throwableProxy) {
    StringBuilder builder = new StringBuilder();
    builder.append(throwableProxy.getClassName()).append(": ").append(throwableProxy.getMessage()).append(CoreConstants.LINE_SEPARATOR);
    for (StackTraceElementProxy step : throwableProxy.getStackTraceElementProxyArray()) {
        String string = step.toString();
        builder.append(CoreConstants.TAB).append(string);
        ThrowableProxyUtil.subjoinPackagingData(builder, step);
        builder.append(CoreConstants.LINE_SEPARATOR);
    }
    return builder.toString();
}
项目:twill    文件:DefaultLogThrowable.java   
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());
}
项目:exhash    文件:ThrowableProxyThrowable.java   
@Override
public StackTraceElement[] getStackTrace() {
    final StackTraceElementProxy[] elements = proxy.getStackTraceElementProxyArray();
    if (elements == null) {
        return null;
    }
    final StackTraceElement[] result = new StackTraceElement[elements.length];
    for (int i = 0; i < elements.length; i++) {
        result[i] = elements[i].getStackTraceElement();
    }
    return result;
}
项目:logstash-logback-layout    文件:EventFormatter.java   
public EventFormatter(ILoggingEvent loggingEvent) {
    message = loggingEvent.getFormattedMessage();
    timestamp = dateFormat(loggingEvent.getTimeStamp());
    sourceHost = new HostData().getHostName();

    loggerName = loggingEvent.getLoggerName();
    threadName = loggingEvent.getThreadName();
    level = loggingEvent.getLevel().toString();

    mdc = loggingEvent.getMDCPropertyMap();

    throwableProxy = loggingEvent.getThrowableProxy();
    if (throwableProxy != null) {
        ArrayList<String> stackTraceElements = new ArrayList();
        for (StackTraceElementProxy stackTraceElement: throwableProxy.getStackTraceElementProxyArray()) {
            stackTraceElements.add(stackTraceElement.getSTEAsString());
        }
        stackTrace = StringUtils.join(stackTraceElements.toArray(), "\n");
        exceptionClass = throwableProxy.getClassName();
        exceptionMessage = throwableProxy.getMessage();
        exceptionInfo = true;
    }

    stackTraceElement = loggingEvent.getCallerData();
    fileName = stackTraceElement[0].getFileName();
    lineNumber = String.valueOf(stackTraceElement[0].getLineNumber());
    className = stackTraceElement[0].getClassName();
    methodName = stackTraceElement[0].getMethodName();
}
项目:bartleby    文件:ThrowableProxyConverter.java   
protected void subjoinSTEPArray(StringBuilder buf, int indent, IThrowableProxy tp) {
  StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
  int commonFrames = tp.getCommonFrames();

  boolean unrestrictedPrinting = lengthOption > stepArray.length;


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

  int ignoredCount = 0;
  for (int i = 0; i < maxIndex; i++) {
    StackTraceElementProxy element = stepArray[i];
    if (!isIgnoredStackTraceLine(element.toString())) {
      ThrowableProxyUtil.indent(buf, indent);
      printStackLine(buf, ignoredCount, element);
      ignoredCount = 0;
      buf.append(CoreConstants.LINE_SEPARATOR);
    } else {
      ++ignoredCount;
      if (maxIndex < stepArray.length) {
        ++maxIndex;
      }
    }
  }
  if (ignoredCount > 0) {
    printIgnoredCount(buf, ignoredCount);
    buf.append(CoreConstants.LINE_SEPARATOR);
  }

  if (commonFrames > 0 && unrestrictedPrinting) {
    ThrowableProxyUtil.indent(buf, indent);
    buf.append("... ").append(tp.getCommonFrames()).append(
            " common frames omitted").append(CoreConstants.LINE_SEPARATOR);
  }
}
项目:bartleby    文件:ThrowableProxyConverter.java   
private void printStackLine(StringBuilder buf, int ignoredCount, StackTraceElementProxy element) {
  buf.append(element);
  extraData(buf, element); // allow other data to be added
  if (ignoredCount > 0) {
    printIgnoredCount(buf, ignoredCount);
  }
}
项目:bartleby    文件:SyslogAppender.java   
@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();
  }
}
项目:bartleby    文件:CorpusModel.java   
private void pupulateWithPackagingData(StackTraceElementProxy[] stepArray) {
  int i = 0;
  for (StackTraceElementProxy step : stepArray) {
    String identifier = "na";
    String version = "na";
    if (i++ % 2 == 0) {
      identifier = getRandomJavaIdentifier();
      version = getRandomJavaIdentifier();
    }
    ClassPackagingData cpd = new ClassPackagingData(identifier, version);
    step.setClassPackagingData(cpd);
  }
}
项目:otroslogviewer    文件:LogbackUtil.java   
public static void addException(IThrowableProxy throwableProxy, String message, LogDataBuilder builder) {
  if (throwableProxy != null) {
    StringBuilder sb = new StringBuilder();
    sb.append(message).append("\n");
    sb.append(throwableProxy.getClassName()).append(": ").append(throwableProxy.getMessage()).append("\n");

    for (StackTraceElementProxy stackTraceElementProxy : throwableProxy.getStackTraceElementProxyArray()) {
      sb.append("\t").append(stackTraceElementProxy.getSTEAsString()).append("\n");
    }
    builder.withMessage(sb.toString());
  }
}
项目:logback-raygun    文件:RaygunAppender.java   
/**
 * Builds a raygun stack trace from the given logback throwable proxy object.
 * @param throwableProxy The logback throwable proxy.
 * @return The raygun stack trace information.
 */
private static RaygunErrorStackTraceLineMessage[] buildRaygunStack(IThrowableProxy throwableProxy)
{
  final StackTraceElementProxy[] proxies = throwableProxy.getStackTraceElementProxyArray();
  final RaygunErrorStackTraceLineMessage[] lines = new RaygunErrorStackTraceLineMessage[proxies.length];

  for (int i = 0; i < proxies.length; i++)
  {
    final StackTraceElementProxy step = proxies[i];
    lines[i] = new RaygunErrorStackTraceLineMessage(step.getStackTraceElement());
  }

  return lines;
}
项目:BikeMan    文件:MillisecondPrecisionSyslogAppender.java   
@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();
    }
}
项目:incubator-twill    文件:DefaultLogThrowable.java   
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());
}
项目:jakduk-api    文件:SlackAppender.java   
private String getStackTrace(StackTraceElementProxy[] stackTraceElements) {
    if (stackTraceElements == null || stackTraceElements.length == 0) {
        return null;
    }

    StringBuilder sb = new StringBuilder();
    for (StackTraceElementProxy element : stackTraceElements) {
        sb.append(element.toString());
        sb.append("\n");
    }
    return sb.toString();
}
项目:olfs    文件:OlfsControlApi.java   
private String formatLoggingEvent(LoggingEvent event){


        //private String PATTERN = "%d{yyyy-MM-dd'T'HH:mm:ss.SSS Z} [thread:%t] [%r][%X{ID}] [%X{SOURCE}]   %-5p - %c - %m%n";

        StringBuffer sbuf = new StringBuffer(128);
        Date date = new Date(event.getTimeStamp());

        SimpleDateFormat simpleDateFormat;
        simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");


        sbuf.append(simpleDateFormat.format(date));
        sbuf.append(" ");
        sbuf.append(" [").append(event.getThreadName()).append("] ");
        sbuf.append(event.getLevel());
        sbuf.append(" - ");
        sbuf.append(event.getLoggerName());
        sbuf.append(" - ");
        sbuf.append(event.getFormattedMessage());
        sbuf.append("\n");

        IThrowableProxy itp = event.getThrowableProxy();
        if(itp!=null){
            for(StackTraceElementProxy ste  : itp.getStackTraceElementProxyArray()){
                sbuf.append("    ").append(ste);
                sbuf.append("\n");
            }
        }
        return sbuf.toString();

    }
项目:logging-java    文件:MillisecondPrecisionSyslogAppender.java   
@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();
  }
}
项目:logback-extensions    文件:HockeyAppCrashAppenderService.java   
private String parseStringArrayMessage(IThrowableProxy throwableProxy) {
    String throwableClassName = throwableProxy.getClassName();
    String throwableMessage = throwableProxy.getMessage();
    StackTraceElementProxy[] stackTraceElementProxyArray = throwableProxy.getStackTraceElementProxyArray();
    logger.debug("Parse exception message with"
            + stackTraceElementProxyArray.length + "elements to create the correct crash log file.");
    StringBuffer buffer = new StringBuffer();
    createFirstLine(throwableClassName, throwableMessage, buffer);

    for (StackTraceElementProxy stackColumn : stackTraceElementProxyArray) {
        buffer.append("\t").append(stackColumn.getSTEAsString()).append("\n");
    }
    return buffer.toString();
}
项目:bartleby    文件:ThrowableProxyConverter.java   
protected void extraData(StringBuilder builder, StackTraceElementProxy step) {
  // nop
}
项目:bartleby    文件:ExtendedThrowableProxyConverter.java   
@Override
protected void extraData(StringBuilder builder, StackTraceElementProxy step) {
  ThrowableProxyUtil.subjoinPackagingData(builder, step);
}
项目:bither-desktop-java    文件:PrefixedExtendedThrowableProxyConverter.java   
@Override
protected void extraData(StringBuilder builder, StackTraceElementProxy step) {
    if (step != null) {
        ThrowableProxyUtil.subjoinPackagingData(builder, step);
    }
}
项目:bugsnag-logback    文件:MockThrowableProxy.java   
public MockThrowableProxy addStackTraceElementProxy(final MockStackTraceElement stackTraceElement) {
    final List<StackTraceElementProxy> list = Lists.newArrayList(stackTraceElements);
    list.add(stackTraceElement.toStacktStackTraceElementProxy());
    stackTraceElements = list.toArray(stackTraceElements);
    return this;
}
项目:bugsnag-logback    文件:MockThrowableProxy.java   
@Override
public StackTraceElementProxy[] getStackTraceElementProxyArray() {
    return stackTraceElements;
}
项目:bugsnag-logback    文件:MockStackTraceElement.java   
public StackTraceElementProxy toStacktStackTraceElementProxy() {
    return new StackTraceElementProxy(new StackTraceElement(declaringClass, methodName, fileName, lineNumber));
}
项目:logback-steno    文件:StenoSerializationHelper.java   
/**
 * This function assumes the field object has already been started for this throwable, this only fills in
 * the fields in the 'exception' or equivalent object and does not create the field in the containing object.
 *
 * @since 1.7.0
 * @param throwableProxy Throwable to serialize
 * @param jsonGenerator  <code>JsonGenerator</code> instance after exception object is started
 * @param objectMapper <code>ObjectMapper</code> instance.
 * @throws IOException If writing the <code>Throwable</code> as JSON fails.
 */
public static void serializeThrowable(
        final IThrowableProxy throwableProxy,
        final JsonGenerator jsonGenerator,
        final ObjectMapper objectMapper)
        throws IOException {

    jsonGenerator.writeStringField("type", throwableProxy.getClassName());
    jsonGenerator.writeStringField("message", throwableProxy.getMessage());
    jsonGenerator.writeArrayFieldStart("backtrace");
    for (final StackTraceElementProxy ste : throwableProxy.getStackTraceElementProxyArray()) {
        jsonGenerator.writeString(ste.toString());
    }
    jsonGenerator.writeEndArray();
    jsonGenerator.writeObjectFieldStart("data");
    if (throwableProxy instanceof ThrowableProxy) {
        final JsonNode jsonNode = objectMapper.valueToTree(((ThrowableProxy) throwableProxy).getThrowable());
        for (final Iterator<Map.Entry<String, JsonNode>> iterator = jsonNode.fields(); iterator.hasNext();) {
            final Map.Entry<String, JsonNode> field = iterator.next();
            jsonGenerator.writeFieldName(field.getKey());
            objectMapper.writeValue(
                    jsonGenerator,
                    field.getValue());
        }
    }
    // Although Throwable has a final getSuppressed which cannot return a null array, the
    // proxy in Logback provides no such guarantees.
    if (throwableProxy.getSuppressed() != null && throwableProxy.getSuppressed().length > 0) {
        jsonGenerator.writeArrayFieldStart("suppressed");
        for (final IThrowableProxy suppressed : throwableProxy.getSuppressed()) {
            jsonGenerator.writeStartObject();
            serializeThrowable(suppressed, jsonGenerator, objectMapper);
            jsonGenerator.writeEndObject();
        }
        jsonGenerator.writeEndArray();
    }
    if (throwableProxy.getCause() != null) {
        jsonGenerator.writeObjectFieldStart("cause");
        serializeThrowable(throwableProxy.getCause(), jsonGenerator, objectMapper);
        jsonGenerator.writeEndObject();
    }
    jsonGenerator.writeEndObject();
}
项目:logback-steno    文件:StenoSerializationHelperTest.java   
@Override
public StackTraceElementProxy[] getStackTraceElementProxyArray() {
    return new StackTraceElementProxy[0];
}
项目:bither-desktop-java    文件:PrefixedExtendedThrowableProxyConverter.java   
@Override
protected void extraData(StringBuilder builder, StackTraceElementProxy step) {
    if (step != null) {
        ThrowableProxyUtil.subjoinPackagingData(builder, step);
    }
}