当前位置: 首页>>代码示例>>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;未经允许,请勿转载。