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


Java ThrowableProxyUtil类代码示例

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


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

示例1: fullDump

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

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

示例3: recursiveAppendRootCauseFirst

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

示例4: append

import ch.qos.logback.classic.spi.ThrowableProxyUtil; //导入依赖的package包/类
@Override
protected void append(ILoggingEvent rawData) {
	final Map<String, Object> data = new HashMap<String, Object>();
	data.put("message", rawData.getFormattedMessage());
	data.put("logger", rawData.getLoggerName());
	data.put("thread", rawData.getThreadName());
	data.put("level", rawData.getLevel());
	if (rawData.getMarker() != null) {
		data.put("marker", rawData.getMarker());
	}
	if (rawData.hasCallerData()) {
		data.put("caller", new CallerDataConverter().convert(rawData));
	}
	if (rawData.getThrowableProxy() != null) {
		data.put("throwable", ThrowableProxyUtil.asString(rawData.getThrowableProxy()));
	}
	for (Entry<String, String> entry : rawData.getMDCPropertyMap().entrySet()) {
		data.put(entry.getKey(), entry.getValue());
	}
	fluentLogger.log(label, data, rawData.getTimeStamp() / 1000);
}
 
开发者ID:linux-china,项目名称:logback-fluentd-appender,代码行数:22,代码来源:DataFluentAppender.java

示例5: errorAppender

import ch.qos.logback.classic.spi.ThrowableProxyUtil; //导入依赖的package包/类
private void errorAppender(StringBuilder sb, ILoggingEvent iLoggingEvent)
{
    if ( iLoggingEvent.getThrowableProxy() != null )
    {
        appendKeyValueAndEscape(sb, ERROR.toString(), ThrowableProxyUtil.asString(iLoggingEvent.getThrowableProxy()));
    }
}
 
开发者ID:BatchLabs,项目名称:escalog,代码行数:8,代码来源:LogFmtLayout.java

示例6: fullDump

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

示例7: dump

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

示例8: append

import ch.qos.logback.classic.spi.ThrowableProxyUtil; //导入依赖的package包/类
@Override
protected void append (ILoggingEvent event) {

    if (MMDBot.state.isReady()) {

        final Level level = event.getLevel();
        final EmbedBuilder embed = new EmbedBuilder();

        if (level == Level.DEBUG && !event.getLoggerName().equalsIgnoreCase("MMDBot")) {
            return;
        }

        if (level == Level.TRACE && event.getLoggerName().equalsIgnoreCase("sx.blah.discord.Discord4J")) {
            return;
        }

        embed.withTitle(level.levelStr);

        embed.withColor(level == Level.DEBUG ? DEBUG : level == Level.ERROR || level == Level.TRACE ? ERROR : level == Level.INFO ? INFO : level == Level.WARN ? WARN : UNKNOWN);

        embed.withDesc(event.getFormattedMessage() + " - Logger: " + event.getLoggerName());

        if (event.getThrowableProxy() != null) {
            embed.appendDesc(Utilities.SEPERATOR + ThrowableProxyUtil.asString(event.getThrowableProxy()));
        }

        Utilities.sendMessage(MMDBot.state.getConsoleChannel(), embed.build());
    }
}
 
开发者ID:MinecraftModDevelopment,项目名称:MMDBot,代码行数:30,代码来源:LoggingHandler.java

示例9: recursiveAppend

import ch.qos.logback.classic.spi.ThrowableProxyUtil; //导入依赖的package包/类
private void recursiveAppend(StringBuilder sb, String prefix, int indent, IThrowableProxy tp) {
  if(tp == null)
    return;
  subjoinFirstLine(sb, prefix, indent, tp);
  sb.append(CoreConstants.LINE_SEPARATOR);
  subjoinSTEPArray(sb, indent, tp);
  IThrowableProxy[] suppressed = tp.getSuppressed();
  if(suppressed != null) {
    for(IThrowableProxy current : suppressed) {
      recursiveAppend(sb, CoreConstants.SUPPRESSED, indent + ThrowableProxyUtil.SUPPRESSED_EXCEPTION_INDENT, current);
    }
  }
  recursiveAppend(sb, CoreConstants.CAUSED_BY, indent, tp.getCause());
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:15,代码来源:ThrowableProxyConverter.java

示例10: subjoinFirstLine

import ch.qos.logback.classic.spi.ThrowableProxyUtil; //导入依赖的package包/类
private void subjoinFirstLine(StringBuilder buf, String prefix, int indent, IThrowableProxy tp) {
  ThrowableProxyUtil.indent(buf, indent - 1);
  if (prefix != null) {
    buf.append(prefix);
  }
  subjoinExceptionMessage(buf, tp);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:8,代码来源:ThrowableProxyConverter.java

示例11: subjoinSTEPArray

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

示例12: dump

import ch.qos.logback.classic.spi.ThrowableProxyUtil; //导入依赖的package包/类
/**
 * Dump the events passed as argument into the file named targetFile.
 * 
 * @param eventArray
 * @param targetFile
 * @throws IOException
 */
public static void dump(ILoggingEvent[] eventArray, String targetFile)
    throws IOException {
  FileWriter fw = new FileWriter(targetFile);
  for (ILoggingEvent e : eventArray) {
    fw.write(e.toString());
    fw.append(CoreConstants.LINE_SEPARATOR);
    if (e.getThrowableProxy() != null) {
      IThrowableProxy tp = e.getThrowableProxy();
      fw.write(ThrowableProxyUtil.asString(tp));
    }
  }
  fw.flush();
  fw.close();
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:22,代码来源:Corpus.java

示例13: throwableProxyToString

import ch.qos.logback.classic.spi.ThrowableProxyUtil; //导入依赖的package包/类
@Override
protected String throwableProxyToString(IThrowableProxy tp) {
  StringBuilder buf = new StringBuilder(BUILDER_CAPACITY);
  recursiveAppendRootCauseFirst(buf, null, ThrowableProxyUtil.REGULAR_EXCEPTION_INDENT, tp);
  return buf.toString();
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:7,代码来源:RootCauseFirstThrowableProxyConverter.java

示例14: extraData

import ch.qos.logback.classic.spi.ThrowableProxyUtil; //导入依赖的package包/类
@Override
protected void extraData(StringBuilder builder, StackTraceElementProxy step) {
  ThrowableProxyUtil.subjoinPackagingData(builder, step);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:5,代码来源:ExtendedThrowableProxyConverter.java

示例15: extraData

import ch.qos.logback.classic.spi.ThrowableProxyUtil; //导入依赖的package包/类
@Override
protected void extraData(StringBuilder builder, StackTraceElementProxy step) {
    if (step != null) {
        ThrowableProxyUtil.subjoinPackagingData(builder, step);
    }
}
 
开发者ID:bither,项目名称:bither-desktop-java,代码行数:7,代码来源:PrefixedExtendedThrowableProxyConverter.java


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