org.apache.log4j.MDC.remove()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(185)

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

MDC.remove介绍

[英]Remove the the context identified by the key parameter.
[中]删除由key参数标识的上下文。

代码示例

代码示例来源:origin: org.slf4j/slf4j-log4j12

public void remove(String key) {
  org.apache.log4j.MDC.remove(key);
}

代码示例来源:origin: hibernate/hibernate-orm

public void removeMdc(String key) {
  MDC.remove( key );
}

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

public void removeMdc(String key) {
  MDC.remove(key);
}

代码示例来源:origin: openzipkin/brave

@Override protected void remove(String key) {
 MDC.remove(key);
}

代码示例来源:origin: org.freemarker/freemarker

/**
 * Returns if Log4j-over-SLF4J is actually working. Sometimes the API classes are present, but there's no SLF4J
 * implementation around.
 */
public static final boolean test() {
  org.apache.log4j.MDC.put(MDC_KEY, "");
  try {
    return org.slf4j.MDC.get(MDC_KEY) != null;
  } finally {
    org.apache.log4j.MDC.remove(MDC_KEY);
  }
}

代码示例来源:origin: blazegraph/database

/**
 * Clear the logging context.
 */
protected void clearLoggingContext() {
  
  MDC.remove("serviceName");
  MDC.remove("serviceUUID");
  MDC.remove("hostname");
  
}

代码示例来源:origin: com.blazegraph/bigdata-core

/**
 * Clear the logging context.
 */
protected void clearLoggingContext() {
  
  MDC.remove("serviceName");
  MDC.remove("serviceUUID");
  MDC.remove("hostname");
  
}

代码示例来源:origin: com.custardsource.parfait/parfait-core

@Override
  public void remove(String key) {
    org.apache.log4j.MDC.remove(key);
  }
}

代码示例来源:origin: io.tracee.backend/tracee-log4j

@Override
  protected void removeFromMdc(String key) {
    MDC.remove(key);
  }
}

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

public void remove(String key)
  {
   MDC.remove(key);
  }
}

代码示例来源:origin: com.blazegraph/bigdata-core

/**
 * Clear fields set by {@link #setupLoggingContext()} from the {@link MDC}
 * logging context.
 */
protected void clearLoggingContext() {
  MDC.remove("taskname");
  MDC.remove("timestamp");
  if(log.isInfoEnabled())
  MDC.remove("resources");
  
}

代码示例来源:origin: blazegraph/database

/**
 * Clear fields set by {@link #setupLoggingContext()} from the {@link MDC}
 * logging context.
 */
protected void clearLoggingContext() {
  MDC.remove("taskname");
  MDC.remove("timestamp");
  if(log.isInfoEnabled())
  MDC.remove("resources");
  
}

代码示例来源:origin: com.netflix.blitz4j/blitz4j

/**
 * Clears any logging information that was cached for the purpose of
 * logging.
 */
private void clearLocationInfo() {
  MDC.remove(LOCATION_INFO);
  stackLocal.set(null);
}

代码示例来源:origin: xwjie/ElementVueSpringbootCodeTemplate

public static void clearAllUserInfo() {
  tlUser.remove();
  tlLocale.remove();
  MDC.remove(KEY_USER);
}

代码示例来源:origin: com.foreach.cwb/cwb-core

@Override
public void after( Match match, Result result ) {
  super.after( match, result );
  MDC.remove( "prefix" );
}

代码示例来源:origin: com.foreach.cwb/cwb-core

@Override
  public void background( Background background ) {
    super.background( background );

LOG.info( "--------------------------------------------------------" );
    MDC.put( "prefix", PREFIX_BACKGROUND );
//        MDC.put( "scenarioId", scenarioOutline.getLine() );
    LOG.info( "" );
    MDC.remove( "prefix" );
  }

代码示例来源:origin: com.alibaba.edas/edas-sdk

@Override
  public void beforeSet(RpcContext_inner context) {
    if (context != null) {
      MDC.put("EAGLEEYE_TRACE_ID", context.getTraceId());
      MDC.put("EAGLEEYE_RPC_ID", context.getRpcId());
    } else {
      MDC.remove("EAGLEEYE_TRACE_ID");
      MDC.remove("EAGLEEYE_RPC_ID");
    }
  }
}

代码示例来源:origin: com.allen-sauer.gwt.log/gwt-log

@Override
public void log(LogRecord record) {
 Set<Entry<String, String>> set = record.getMapEntrySet();
 for (Entry<String, String> entry : set) {
  MDC.put(entry.getKey(), entry.getValue());
 }
 logger.log(Level.toLevel(mapGWTLogLevelToImplLevel(record.getLevel())), record.getMessage(),
   record.getThrowable());
 for (Entry<String, String> entry : set) {
  MDC.remove(entry.getKey());
 }
}

代码示例来源:origin: com.foreach.cwb/cwb-core

@Override
public void scenarioOutline( ScenarioOutline scenarioOutline ) {
  super.scenarioOutline( scenarioOutline );
  countScenario();
  LOG.info( "--------------------------------------------------------" );
  MDC.put( "prefix", PREFIX_SCENARIO );
  MDC.put( "scenarioId", scenarioOutline.getLine() );
  LOG.info( scenarioOutline.getName() );
  MDC.remove( "prefix" );
}

代码示例来源:origin: com.foreach.cwb/cwb-core

@Override
public void scenario( Scenario scenario ) {
  super.scenario( scenario );
  countScenario();
  LOG.info( "--------------------------------------------------------" );
  MDC.put( "prefix", PREFIX_SCENARIO );
  MDC.put( "scenarioId", scenario.getLine() );
  LOG.info( scenario.getName() );
  MDC.remove( "prefix" );
}

相关文章