當前位置: 首頁>>代碼示例>>Java>>正文


Java ILoggingEvent.getThrowableProxy方法代碼示例

本文整理匯總了Java中ch.qos.logback.classic.spi.ILoggingEvent.getThrowableProxy方法的典型用法代碼示例。如果您正苦於以下問題:Java ILoggingEvent.getThrowableProxy方法的具體用法?Java ILoggingEvent.getThrowableProxy怎麽用?Java ILoggingEvent.getThrowableProxy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ch.qos.logback.classic.spi.ILoggingEvent的用法示例。


在下文中一共展示了ILoggingEvent.getThrowableProxy方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: append

import ch.qos.logback.classic.spi.ILoggingEvent; //導入方法依賴的package包/類
@Override
protected void append(ILoggingEvent event) {
  LogOutput target = tlTtarget.get();
  if (target == null) {
    defaultAppender.doAppend(event);
    return;
  }

  String msg;
  if (event.getThrowableProxy() == null) {
    msg = event.getFormattedMessage();
  } else {
    ExtendedThrowableProxyConverter throwableConverter = new ExtendedThrowableProxyConverter();
    throwableConverter.start();
    msg = event.getFormattedMessage() + "\n" + throwableConverter.convert(event);
    throwableConverter.stop();
  }

  target.log(msg, translate(event.getLevel()));
}
 
開發者ID:instalint-org,項目名稱:instalint,代碼行數:21,代碼來源:LogCallbackAppender.java

示例2: append

import ch.qos.logback.classic.spi.ILoggingEvent; //導入方法依賴的package包/類
@Override
protected void append(ILoggingEvent loggingEvent) {
    appendToLog(loggingEvent, loggingEvent.getFormattedMessage());
    if (loggingEvent.getThrowableProxy() != null) {
        appendThrowable(loggingEvent.getThrowableProxy(), loggingEvent);
    }
}
 
開發者ID:StuPro-TOSCAna,項目名稱:TOSCAna,代碼行數:8,代碼來源:MemoryAppender.java

示例3: getException

import ch.qos.logback.classic.spi.ILoggingEvent; //導入方法依賴的package包/類
private IThrowableProxy getException(ILoggingEvent event) {
    final IThrowableProxy throwableProxy = event.getThrowableProxy();
    if (throwableProxy != null) {
        final IThrowableProxy cause = throwableProxy.getCause();
        if (cause != null) {
            return cause;
        }
    }
    return null;
}
 
開發者ID:line,項目名稱:centraldogma,代碼行數:11,代碼來源:ExpectedExceptionAppender.java

示例4: matches

import ch.qos.logback.classic.spi.ILoggingEvent; //導入方法依賴的package包/類
public boolean matches(ILoggingEvent event) {
  if (event.getThrowableProxy() == null) {
    return false;
  }

  return expectedMessageMatcher.matches(event.getThrowableProxy().getMessage()) &&
    expectedException.matches(event.getThrowableProxy());
}
 
開發者ID:mustaine,項目名稱:logcapture,代碼行數:9,代碼來源:ExpectedLoggedException.java

示例5: writeTo

import ch.qos.logback.classic.spi.ILoggingEvent; //導入方法依賴的package包/類
@Override
public void writeTo(JsonGenerator generator, ILoggingEvent event) throws IOException {
    if (require) {
        ThrowableProxy proxy = (ThrowableProxy) event.getThrowableProxy();
        AbstractLoggingException exception = AbstractLoggingException.getFromThrowableProxy(proxy);

        if (exception != null) {
            JsonWritingUtils.writeStringField(generator, getFieldName(), getValue(exception));
        }
    }
}
 
開發者ID:hmcts,項目名稱:java-logging,代碼行數:12,代碼來源:AbstractRequireJsonProvider.java

示例6: doLayout

import ch.qos.logback.classic.spi.ILoggingEvent; //導入方法依賴的package包/類
@Override
public String doLayout(ILoggingEvent event) {
    Instant instant = Instant.ofEpochMilli(event.getTimeStamp());
    ZonedDateTime dateTime = ZonedDateTime.ofInstant(instant, ZoneId.systemDefault());
    StringBuilder log = new StringBuilder(dateTime.format(dateFormat));

    log.append(String.format(" %-5s", event.getLevel().levelStr));

    if (requireThread) {
        log.append(String.format(" [%s]", event.getThreadName()));
    }

    int lineNumber = event.getCallerData().length > 0 ? event.getCallerData()[0].getLineNumber() : 0;

    log.append(String.format(" %s:%d: ", event.getLoggerName(), lineNumber));

    ThrowableProxy proxy = (ThrowableProxy) event.getThrowableProxy();

    if (requireAlertLevel || requireErrorCode) {
        appendExtraExceptionFlags(log, AbstractLoggingException.getFromThrowableProxy(proxy));
    }

    log.append(event.getFormattedMessage()).append(CoreConstants.LINE_SEPARATOR);

    appendStackTrace(log, proxy);

    if (proxy != null) {
        loopCauses(log, proxy, 0);
    }

    return log.toString();
}
 
開發者ID:hmcts,項目名稱:java-logging,代碼行數:33,代碼來源:ReformLoggingLayout.java

示例7: errorAppender

import ch.qos.logback.classic.spi.ILoggingEvent; //導入方法依賴的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

示例8: render

import ch.qos.logback.classic.spi.ILoggingEvent; //導入方法依賴的package包/類
public void render(StringBuilder sbuf, ILoggingEvent event) {
    IThrowableProxy tp = event.getThrowableProxy();
    while (tp != null) {
        render(sbuf, tp);
        tp = tp.getCause();
    }
}
 
開發者ID:zhaoqilong3031,項目名稱:spring-cloud-samples,代碼行數:8,代碼來源:DefaultThrowableRenderer.java

示例9: append

import ch.qos.logback.classic.spi.ILoggingEvent; //導入方法依賴的package包/類
@Override
protected void append(ILoggingEvent event) {
	if(!("info".equalsIgnoreCase(event.getLevel().toString()) || "error".equalsIgnoreCase(event.getLevel().toString())) )
		return;
	// TODO Auto-generated method stub
	org.apache.log4j.spi.LoggingEvent a;
	List<LogItem> logItems = new ArrayList<LogItem>();
	LogItem item = new LogItem();
	logItems.add(item);
	item.SetTime((int) (event.getTimeStamp() / 1000));
	item.PushBack("time", formatter.format(new Date(event.getTimeStamp())));
	item.PushBack("level", event.getLevel().toString());
	item.PushBack("thread", event.getThreadName());
	item.PushBack("location", event.getLoggerName());
	item.PushBack("user", "登錄用戶");
	item.PushBack("ip", "登錄用戶");
	StringBuilder sbuf = new StringBuilder(event.getFormattedMessage());
	if (event.getThrowableProxy() != null) {
		throwableRenderer.render(sbuf, event);
	}
	
	Map properties = event.getMDCPropertyMap();
	if (properties.size() > 0) {
		Object[] keys = properties.keySet().toArray();
		Arrays.sort(keys);
		for (int i = 0; i < keys.length; i++) {
			item.PushBack(keys[i].toString(), properties.get(keys[i]).toString());
		}
	}
	
	item.PushBack("message", sbuf.toString());
	producer.send(projectConfig.projectName, logstore, topic, null, logItems);
}
 
開發者ID:zhaoqilong3031,項目名稱:spring-cloud-samples,代碼行數:34,代碼來源:LoghubAppender.java

示例10: appendersCalled

import ch.qos.logback.classic.spi.ILoggingEvent; //導入方法依賴的package包/類
public void appendersCalled(ILoggingEvent event) {
  IThrowableProxy throwableProxy = event.getThrowableProxy();
  String throwable = (throwableProxy != null) ? throwableProxy.getClassName() : null;
  LogLevel level = LogLevel.valueOf(event.getLevel().toString());
  tracker.track(level, (throwableProxy != null), throwable);
}
 
開發者ID:ApptuitAI,項目名稱:JInsight,代碼行數:7,代碼來源:LogbackRuleHelper.java


注:本文中的ch.qos.logback.classic.spi.ILoggingEvent.getThrowableProxy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。