当前位置: 首页>>代码示例>>Java>>正文


Java ThreadContext.get方法代码示例

本文整理汇总了Java中org.apache.logging.log4j.ThreadContext.get方法的典型用法代码示例。如果您正苦于以下问题:Java ThreadContext.get方法的具体用法?Java ThreadContext.get怎么用?Java ThreadContext.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.logging.log4j.ThreadContext的用法示例。


在下文中一共展示了ThreadContext.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: filter

import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
private Result filter() {
    boolean match = false;
    if (useMap) {
        for (final Map.Entry<String, List<String>> entry : getMap().entrySet()) {
            final String toMatch = ThreadContext.get(entry.getKey());
            if (toMatch != null) {
                match = entry.getValue().contains(toMatch);
            } else {
                match = false;
            }
            if ((!isAnd() && match) || (isAnd() && !match)) {
                break;
            }
        }
    } else {
        match = value.equals(ThreadContext.get(key));
    }
    return match ? onMatch : onMismatch;
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:20,代码来源:ThreadContextMapFilter.java

示例2: get

import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
@Override
public String get(final String key) {
    return ThreadContext.get(key);
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:5,代码来源:Log4jMDCAdapter.java

示例3: baseCleanup

import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
@AfterMethod(alwaysRun = true)
public void baseCleanup(ITestContext context, ITestResult result, Object[] params) throws IOException {
	if (params.length > 0 && params[0] instanceof WebDriverInstance){
		WebDriverInstance webDriverInstance = (WebDriverInstance)params[0];
		webDriverInstance.cleanup();
	}
	logTestResult(result);
	String tag = ThreadContext.get(THREAD_TAG);
	logger.info("Test is finished, removing the tag [{}]...", tag);
	ThreadContext.remove(THREAD_TAG);
	result.setAttribute(THREAD_TAG, tag);
}
 
开发者ID:3pillarlabs,项目名称:AutomationFrameworkTPG,代码行数:13,代码来源:TestBase.java

示例4: decreaseIndent

import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
/**
 * Decrease the indent for the logger.
 * This applies only for the current thread.
 */
public static void decreaseIndent() {
    String currentIndent = ThreadContext.get("indent");
    int newIndentSize = currentIndent.length() - DEFAULT_INDENT.length();

    ThreadContext.put("indent", currentIndent.substring(0, newIndentSize));
}
 
开发者ID:LearnLib,项目名称:alex,代码行数:11,代码来源:LoggerUtil.java

示例5: filter

import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
private Result filter(final Level level) {
    final Object value = ThreadContext.get(key);
    if (value != null) {
        Level ctxLevel = levelMap.get(value);
        if (ctxLevel == null) {
            ctxLevel = defaultThreshold;
        }
        return level.isAtLeastAsSpecificAs(ctxLevel) ? onMatch : onMismatch;
    }
    return Result.NEUTRAL;

}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:13,代码来源:DynamicThresholdFilter.java

示例6: currentRequestId

import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
public static String currentRequestId(Exchange exchange) {
  return exchange == null ? ThreadContext.get(REQUEST_ID)
      : exchange.getProperty(REQUEST_ID, String.class);
}
 
开发者ID:eXcellme,项目名称:eds,代码行数:5,代码来源:RequestIdManager.java

示例7: increaseIndent

import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
/**
 * Increase the indent for the logger.
 * This applies only for the current thread.
 */
public static void increaseIndent() {
    String currentIndent = ThreadContext.get("indent");

    ThreadContext.put("indent", currentIndent + DEFAULT_INDENT);
}
 
开发者ID:LearnLib,项目名称:alex,代码行数:10,代码来源:LoggerUtil.java

示例8: getLoginId

import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
public static String getLoginId() {
    return ThreadContext.get(LOGIN_ID);
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:4,代码来源:RequestContext.java

示例9: getId

import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
public static String getId() {
    return ThreadContext.get(REQUEST_ID);
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:4,代码来源:RequestContext.java

示例10: getSessionId

import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
public static String getSessionId() {
    return ThreadContext.get(SESSION_ID);
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:4,代码来源:RequestContext.java

示例11: getUserId

import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
public static String getUserId() {
    return ThreadContext.get(USER_ID);
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:4,代码来源:RequestContext.java

示例12: getRequestURI

import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
public static String getRequestURI() {
    return ThreadContext.get(REQUEST_URI);
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:4,代码来源:RequestContext.java

示例13: getUserAgent

import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
public static String getUserAgent() {
    return ThreadContext.get(USER_AGENT);
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:4,代码来源:RequestContext.java

示例14: getRegion

import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
public static String getRegion() {
    return ThreadContext.get(REGION);
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:4,代码来源:RequestContext.java

示例15: getUserType

import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
public static String getUserType() {
    return ThreadContext.get(USER_TYPE);
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:4,代码来源:RequestContext.java


注:本文中的org.apache.logging.log4j.ThreadContext.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。