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


Java StackTraceElementProxy类代码示例

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


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

示例1: fullDump

import ch.qos.logback.classic.spi.StackTraceElementProxy; //导入依赖的package包/类
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";
	}
}
 
开发者ID:guci314,项目名称:playorm,代码行数:21,代码来源:CassandraAppender.java

示例2: appendThrowable

import ch.qos.logback.classic.spi.StackTraceElementProxy; //导入依赖的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

示例3: appendStackTrace

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

示例4: render

import ch.qos.logback.classic.spi.StackTraceElementProxy; //导入依赖的package包/类
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);
    }
}
 
开发者ID:zhaoqilong3031,项目名称:spring-cloud-samples,代码行数:19,代码来源:DefaultThrowableRenderer.java

示例5: build

import ch.qos.logback.classic.spi.StackTraceElementProxy; //导入依赖的package包/类
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;
}
 
开发者ID:Saisimon,项目名称:tip,代码行数:25,代码来源:LoggingInfo.java

示例6: render

import ch.qos.logback.classic.spi.StackTraceElementProxy; //导入依赖的package包/类
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);
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:20,代码来源:DefaultThrowableRenderer.java

示例7: testAppendThrowable

import ch.qos.logback.classic.spi.StackTraceElementProxy; //导入依赖的package包/类
@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]);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:24,代码来源:HTMLLayoutTest.java

示例8: subjoinThrowableProxy

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

示例9: convertToStackTraces

import ch.qos.logback.classic.spi.StackTraceElementProxy; //导入依赖的package包/类
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;
}
 
开发者ID:codereligion,项目名称:bugsnag-logback,代码行数:19,代码来源:Converter.java

示例10: createThrowableData

import ch.qos.logback.classic.spi.StackTraceElementProxy; //导入依赖的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

示例11: toProto

import ch.qos.logback.classic.spi.StackTraceElementProxy; //导入依赖的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

示例12: fullDump

import ch.qos.logback.classic.spi.StackTraceElementProxy; //导入依赖的package包/类
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();
}
 
开发者ID:aliyun,项目名称:aliyun-log-logback-appender,代码行数:11,代码来源:LoghubAppender.java

示例13: dump

import ch.qos.logback.classic.spi.StackTraceElementProxy; //导入依赖的package包/类
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();
}
 
开发者ID:boxfuse,项目名称:cloudwatchlogs-java-appender,代码行数:12,代码来源:CloudwatchLogsLogbackAppender.java

示例14: DefaultLogThrowable

import ch.qos.logback.classic.spi.StackTraceElementProxy; //导入依赖的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

示例15: getStackTrace

import ch.qos.logback.classic.spi.StackTraceElementProxy; //导入依赖的package包/类
@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;
}
 
开发者ID:tkawachi,项目名称:exhash,代码行数:13,代码来源:ThrowableProxyThrowable.java


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