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


Java IThrowableProxy类代码示例

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


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

示例1: fullDump

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

示例3: render

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

示例4: transformStackTrace

import ch.qos.logback.classic.spi.IThrowableProxy; //导入依赖的package包/类
private String transformStackTrace(ILoggingEvent event) {
    IThrowableProxy throwableProxy = event.getThrowableProxy();
    StackTraceElement stackTraceElement = throwableProxy.getStackTraceElementProxyArray()[0].getStackTraceElement();

    String time = DEFAULT_DATE_FORMAT.format(new Date(event.getTimeStamp()));
    String threadName = event.getThreadName();
    String level = event.getLevel().toString().substring(0, 1);
    String logger = event.getLoggerName();
    String exception = throwableProxy.getClassName();
    String msg = throwableProxy.getMessage();
    String className = stackTraceElement.getClassName();
    String method = stackTraceElement.getMethodName();
    int lineNumber = stackTraceElement.getLineNumber();

    return String.format(FORMAT_MESSAGE, title, time, threadName, level, logger, exception, msg, className, method, lineNumber);
}
 
开发者ID:mitaketw,项目名称:logback-sms-appender,代码行数:17,代码来源:SmsAppender.java

示例5: append

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

示例6: 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

示例7: render

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

示例8: subjoinThrowableProxy

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

示例11: 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

示例12: 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

示例13: testEncodeArrayWithNullSuppressedException

import ch.qos.logback.classic.spi.IThrowableProxy; //导入依赖的package包/类
@Test
@SuppressFBWarnings(value = "SIC_INNER_SHOULD_BE_STATIC_ANON")
public void testEncodeArrayWithNullSuppressedException() throws Exception {
    final LoggingEvent event = new LoggingEvent();
    event.setLevel(Level.INFO);
    event.setMarker(StenoMarker.ARRAY_MARKER);
    event.setMessage("logEvent");
    event.setLoggerContextRemoteView(_context.getLoggerContextRemoteView());
    event.setTimeStamp(0);
    event.setThrowableProxy(new ThrowableProxy(new NullPointerException("npe!")) {
        @Override
        @SuppressFBWarnings(value = "PZLA_PREFER_ZERO_LENGTH_ARRAYS")
        public IThrowableProxy[] getSuppressed() {
            return null;
        }
    });
    final Object[] argArray = new Object[2];
    argArray[0] = new String[]{};
    argArray[1] = new Object[]{};
    event.setArgumentArray(argArray);
    // CHECKSTYLE.OFF: IllegalInstantiation - This is valid case.
    final String logOutput = new String(_encoder.encode(event), _encoder.getCharset());
    // CHECKSTYLE.ON: IllegalInstantiation
    assertOutput("StenoEncoderTest.testEncodeArrayWithNullSuppressedException.json", logOutput);
    assertMatchesJsonSchema(logOutput);
}
 
开发者ID:ArpNetworking,项目名称:logback-steno,代码行数:27,代码来源:StenoEncoderTest.java

示例14: append

import ch.qos.logback.classic.spi.IThrowableProxy; //导入依赖的package包/类
@Override
protected void append(ILoggingEvent event) {
    final IThrowableProxy throwableProxy = event.getThrowableProxy();
    final Map<String, String> mdc = event.getMDCPropertyMap();

    if ((throwableProxy != null) && (throwableProxy instanceof ThrowableProxy)) {
        ThrowableProxy proxy = (ThrowableProxy) throwableProxy;

        if (proxy.getThrowable() != null) {
            Map<String, String> params = new HashMap<>(mdc);

            if (!mdc.containsKey(MESSAGE_PARAM)) {
                params.put(MESSAGE_PARAM, event.getFormattedMessage());
            }

            noticeError(proxy.getThrowable(), params);

            return;
        }
    }

    noticeError(event.getFormattedMessage(), mdc);
}
 
开发者ID:abashev,项目名称:logback-newrelic-appender,代码行数:24,代码来源:NewRelicAppender.java

示例15: append

import ch.qos.logback.classic.spi.IThrowableProxy; //导入依赖的package包/类
@Override
protected void append(ILoggingEvent event) {
    event.prepareForDeferredProcessing();
    //todo do more elegant streaming approach to publish logs

    if (!event.getLevel().equals(Level.ALL) &&         // OFF AND ALL are not loggable levels
            !event.getLevel().equals(Level.OFF)) {
        final IThrowableProxy throwableProxy = event.getThrowableProxy();
        final LogEntry entry = throwableProxy != null ?
                new LogEntry(serverId, event.getFormattedMessage(), Instant.ofEpochMilli(event.getTimeStamp()).toString(),
                        event.getLevel().toString(), event.getLoggerName(), event.getMDCPropertyMap(),
                        event.getThreadName() != null ? event.getThreadName() : null,
                        new Exception(throwableProxy.getMessage(), toStringArray(throwableProxy.getStackTraceElementProxyArray())
                        , throwableProxy.getClassName()))
                : new LogEntry(serverId, event.getFormattedMessage(), Instant.ofEpochMilli(event.getTimeStamp()).toString(),
                event.getLevel().toString(), event.getLoggerName(), event.getMDCPropertyMap(),
                event.getThreadName() != null ? event.getThreadName() : null);
        producer.send(new ProducerRecord<>(kafkaTopic, new Gson().toJson(entry)));
    }
}
 
开发者ID:apache,项目名称:airavata,代码行数:21,代码来源:KafkaAppender.java


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