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

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

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

ThreadContext.pop介绍

[英]Returns the value of the last item placed on the stack.

The returned value is the value that was pushed last. If no context is available, then the empty string "" is returned.
[中]返回堆栈上最后一项的值。
返回的值是上次推送的值。如果没有可用的上下文,则返回空字符串“”。

代码示例

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

private void closeStack() {
    for (int i = 0; i < pushCount; i++) {
      ThreadContext.pop();
    }
    pushCount = 0;
  }
}

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

@Override
public String popNdc() {
  return ThreadContext.pop();
}

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

@Test
public void testPush() {
  ThreadContext.push("Hello");
  ThreadContext.push("{} is {}", ThreadContextTest.class.getSimpleName(),
      "running");
  assertEquals("Incorrect parameterized stack value",
      ThreadContext.pop(), "ThreadContextTest is running");
  assertEquals("Incorrect simple stack value", ThreadContext.pop(),
      "Hello");
}

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

@Test
public void testPush() {
  ThreadContext.push("Hello");
  ThreadContext.push("{} is {}", ThreadContextInheritanceTest.class.getSimpleName(),
      "running");
  assertEquals("Incorrect parameterized stack value",
      ThreadContext.pop(), "ThreadContextInheritanceTest is running");
  assertEquals("Incorrect simple stack value", ThreadContext.pop(),
      "Hello");
}

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

@Test
public void pushAllWillPushAllValues() throws Exception {
  ThreadContext.push(key);
  final List<String> messages = ThreadContext.getImmutableStack().asList();
  ThreadContext.pop();
  try (final CloseableThreadContext.Instance ignored = CloseableThreadContext.pushAll(messages)) {
    assertThat(ThreadContext.peek(), is(key));
  }
  assertThat(ThreadContext.peek(), is(""));
}

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

ThreadContext.pop();
CoreLoggerContexts.stopLoggerContext(false, files[0]); // stop async thread

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

} finally {
  ThreadContext.remove(tcKey);
  ThreadContext.pop();

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

/**
 * Clients should call this method before leaving a diagnostic
 * context.
 * <p>
 * The returned value is the value that was pushed last. If no
 * context is available, then the empty string "" is returned.
 * </p>
 * @return String The innermost diagnostic context.
 */
public static String pop() {
  return org.apache.logging.log4j.ThreadContext.pop();
}

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

/**
 * Clients should call this method before leaving a diagnostic
 * context.
 * <p/>
 * <p>The returned value is the value that was pushed last. If no
 * context is available, then the empty string "" is returned.
 *
 * @return String The innermost diagnostic context.
 */
public static String pop() {
  return org.apache.logging.log4j.ThreadContext.pop();
}

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

/**
 * Clients should call this method before leaving a diagnostic
 * context.
 * <p/>
 * <p>The returned value is the value that was pushed last. If no
 * context is available, then the empty string "" is returned.
 *
 * @return String The innermost diagnostic context.
 */
public static String pop() {
  return org.apache.logging.log4j.ThreadContext.pop();
}

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

@Override
public String popNdc() {
  return ThreadContext.pop();
}

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

@Override
public String popNdc() {
  return ThreadContext.pop();
}

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

@Override
public String popNdc() {
  return ThreadContext.pop();
}

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

@Override
public String popNdc() {
  return ThreadContext.pop();
}

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

@Override
public String popNdc() {
  return ThreadContext.pop();
}

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

@Override
public String popNdc() {
  return ThreadContext.pop();
}

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

@Override
public String popNdc() {
  return ThreadContext.pop();
}

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

@Override
public String popNdc() {
  return ThreadContext.pop();
}

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

private void closeStack() {
    for (int i = 0; i < pushCount; i++) {
      ThreadContext.pop();
    }
    pushCount = 0;
  }
}

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

@Override
public String popNdc() {
  return ThreadContext.pop();
}

相关文章