本文整理汇总了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";
}
}
示例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();
}
}
示例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);
}
}
}
示例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);
}
示例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()));
}
}
示例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();
}
示例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();
}
示例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());
}
}
示例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());
}
示例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);
}
示例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);
}
}
示例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();
}
示例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();
}
示例14: extraData
import ch.qos.logback.classic.spi.ThrowableProxyUtil; //导入依赖的package包/类
@Override
protected void extraData(StringBuilder builder, StackTraceElementProxy step) {
ThrowableProxyUtil.subjoinPackagingData(builder, step);
}
示例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);
}
}