本文整理汇总了Java中org.apache.logging.log4j.ThreadContext.getDepth方法的典型用法代码示例。如果您正苦于以下问题:Java ThreadContext.getDepth方法的具体用法?Java ThreadContext.getDepth怎么用?Java ThreadContext.getDepth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.logging.log4j.ThreadContext
的用法示例。
在下文中一共展示了ThreadContext.getDepth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Log4jLogEvent
import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
/**
* 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 id
null, // thread name
0, // thread priority
null, // StackTraceElement source
CLOCK, //
nanoClock.nanoTime());
}
示例2: Log4jLogEvent
import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
/**
* Constructor.
* @param loggerName The name of the Logger.
* @param marker The Marker or null.
* @param fqcn The fully qualified class name of the caller.
* @param level The logging Level.
* @param message The Message.
* @param properties properties to add to the event.
* @param t A Throwable or null.
*/
public Log4jLogEvent(final String loggerName, final Marker marker, final String fqcn, final Level level,
final Message message, final List<Property> properties, final Throwable t) {
this(loggerName, marker, fqcn, level, message, t,
createMap(properties),
ThreadContext.getDepth() == 0 ? null : ThreadContext.cloneStack(), null,
null, System.currentTimeMillis());
}