org.apache.logging.log4j.ThreadContext.getDepth()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中org.apache.logging.log4j.ThreadContext.getDepth()方法的一些代码示例,展示了ThreadContext.getDepth()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ThreadContext.getDepth()方法的具体详情如下:
包路径:org.apache.logging.log4j.ThreadContext
类名称:ThreadContext
方法名:getDepth

ThreadContext.getDepth介绍

[英]Gets the current nesting depth of this thread's stack.
[中]获取此线程堆栈的当前嵌套深度。

代码示例

代码示例来源:origin: wildfly/wildfly

@Override
public int getNdcDepth() {
  return ThreadContext.getDepth();
}

代码示例来源:origin: apache/activemq-artemis

@Override
public int getNdcDepth() {
  return ThreadContext.getDepth();
}

代码示例来源:origin: org.apache.logging.log4j/log4j12-api

/**
 * Get the current nesting depth of this diagnostic context.
 * @return int The number of elements in the call stack.
 * @see #setMaxDepth
 */
public static int getDepth() {
  return org.apache.logging.log4j.ThreadContext.getDepth();
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

@Override
public int getNdcDepth() {
  return ThreadContext.getDepth();
}

代码示例来源:origin: org.apache.logging.log4j/log4j-1.2-api

/**
 * Get the current nesting depth of this diagnostic context.
 * @return int The number of elements in the call stack.
 * @see #setMaxDepth
 */
public static int getDepth() {
  return org.apache.logging.log4j.ThreadContext.getDepth();
}

代码示例来源:origin: org.jboss.weld.se/weld-se

@Override
public int getNdcDepth() {
  return ThreadContext.getDepth();
}

代码示例来源:origin: weld/core

@Override
public int getNdcDepth() {
  return ThreadContext.getDepth();
}

代码示例来源:origin: weld/core

@Override
public int getNdcDepth() {
  return ThreadContext.getDepth();
}

代码示例来源:origin: org.apache.logging.log4j.adapters/log4j-1.2-api

/**
 * Get the current nesting depth of this diagnostic context.
 * @return int The number of elements in the call stack.
 * @see #setMaxDepth
 */
public static int getDepth() {
  return org.apache.logging.log4j.ThreadContext.getDepth();
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

@Override
public int getNdcDepth() {
  return ThreadContext.getDepth();
}

代码示例来源:origin: apache/activemq-artemis

@Override
public int getNdcDepth() {
  return ThreadContext.getDepth();
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

@Override
public int getNdcDepth() {
  return ThreadContext.getDepth();
}

代码示例来源:origin: org.jboss.weld.se/weld-se-shaded

@Override
public int getNdcDepth() {
  return ThreadContext.getDepth();
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

@Override
public int getNdcDepth() {
  return ThreadContext.getDepth();
}

代码示例来源:origin: org.jboss.weld.servlet/weld-servlet-shaded

@Override
public int getNdcDepth() {
  return ThreadContext.getDepth();
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

result.setThrown(t);
result.setContextData(injector.injectContextData(properties, (StringMap) result.getContextData()));
result.setContextStack(ThreadContext.getDepth() == 0 ? ThreadContext.EMPTY_STACK : ThreadContext.cloneStack());// mutable copy
result.setTimeMillis(message instanceof TimestampMessage
    ? ((TimestampMessage) message).getTimestamp()

代码示例来源:origin: ops4j/org.ops4j.pax.logging

/**
* Constructor.
* @param loggerName The name of the Logger.
* @param marker The Marker or null.
* @param loggerFQCN The fully qualified class name of the caller.
* @param level The logging Level.
* @param message The Message.
* @param properties the properties to be merged with ThreadContext key-value pairs into the event's ReadOnlyStringMap.
* @param t A Throwable or null.
*/
// This constructor is called from LogEventFactories.
public Log4jLogEvent(final String loggerName, final Marker marker, final String loggerFQCN, final Level level,
          final Message message, final List<Property> properties, final Throwable t) {
  this(loggerName, marker, loggerFQCN, level, message, t, null, createContextData(properties),
    ThreadContext.getDepth() == 0 ? null : ThreadContext.cloneStack(), // mutable copy
    0, // thread name
    null, // stack trace element
    0,
    null, // LOG4J2-628 use log4j.Clock for timestamps
    // LOG4J2-744 unless TimestampMessage already has one
    message instanceof TimestampMessage ? ((TimestampMessage) message).getTimestamp() :
      CLOCK.currentTimeMillis(), nanoClock.nanoTime());
}

相关文章