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

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

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

ThreadContext.clear介绍

[英]Clears the context map and stack.
[中]清除上下文映射和堆栈。

代码示例

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

public static void clear() {
  localMap.get().clear();
  ThreadContext.clear();
}

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

public static void clear() {
  localMap.get().clear();
  ThreadContext.clear();
}

代码示例来源:origin: org.apache.logging.log4j.samples/flume-common

public static void initialize() {
  ThreadContext.clear();
  ThreadContext.put(REQUEST_ID, UUIDUtil.getTimeBasedUUID().toString());
}

代码示例来源:origin: org.apache.logging.log4j.samples/flume-common

public LoggingController() {
  ThreadContext.clear();
  RequestContext.setSessionId("session1234");
  RequestContext.setIpAddress("127.0.0.1");
  RequestContext.setClientId("02121");
  RequestContext.setProductName("IB");
  RequestContext.setProductVersion("4.18.1");
  RequestContext.setLocale("en_US");
  RequestContext.setRegion("prod");
}

代码示例来源:origin: org.apache.logging.log4j.samples/flume-common

public LoggingApp(String member) {
  ThreadContext.clear();
  RequestContext.setSessionId("session1234");
  RequestContext.setIpAddress("127.0.0.1");
  RequestContext.setClientId("02121");
  RequestContext.setProductName("IB");
  RequestContext.setProductVersion("4.18.1");
  RequestContext.setLocale("en_US");
  RequestContext.setRegion("prod");
  if (events == null) {
    events = MockEventsSupplier.getAllEvents(member);
  }
}

相关文章