本文整理汇总了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;
}
示例2: get
import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
@Override
public String get(final String key) {
return ThreadContext.get(key);
}
示例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);
}
示例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));
}
示例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;
}
示例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);
}
示例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);
}
示例8: getLoginId
import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
public static String getLoginId() {
return ThreadContext.get(LOGIN_ID);
}
示例9: getId
import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
public static String getId() {
return ThreadContext.get(REQUEST_ID);
}
示例10: getSessionId
import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
public static String getSessionId() {
return ThreadContext.get(SESSION_ID);
}
示例11: getUserId
import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
public static String getUserId() {
return ThreadContext.get(USER_ID);
}
示例12: getRequestURI
import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
public static String getRequestURI() {
return ThreadContext.get(REQUEST_URI);
}
示例13: getUserAgent
import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
public static String getUserAgent() {
return ThreadContext.get(USER_AGENT);
}
示例14: getRegion
import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
public static String getRegion() {
return ThreadContext.get(REGION);
}
示例15: getUserType
import org.apache.logging.log4j.ThreadContext; //导入方法依赖的package包/类
public static String getUserType() {
return ThreadContext.get(USER_TYPE);
}