org.apache.log4j.NDC#getDepth ( )源码实例Demo

下面列出了org.apache.log4j.NDC#getDepth ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

/**
 * Removes the log message from the Log4J NDC after the request is processed.
 */
@Override
public void afterCompletion(WebRequest request, Exception ex) throws Exception {
	NDC.pop();
	if (NDC.getDepth() == 0) {
		NDC.remove();
	}
}
 
/**
 * Removes the log message from the Log4J NDC when the processing thread is
 * exited after the start of asynchronous request handling.
 */
@Override
public void afterConcurrentHandlingStarted(WebRequest request) {
	NDC.pop();
	if (NDC.getDepth() == 0) {
		NDC.remove();
	}
}
 
源代码3 项目: lams   文件: Log4jNestedDiagnosticContextFilter.java
/**
 * Removes the log message from the Log4J NDC after the request is processed
 * and logs the after-request message through Log4J.
 */
@Override
protected void afterRequest(HttpServletRequest request, String message) {
	NDC.pop();
	if (NDC.getDepth() == 0) {
		NDC.remove();
	}
	if (log4jLogger.isDebugEnabled()) {
		log4jLogger.debug(message);
	}
}
 
/**
 * Removes the log message from the Log4J NDC after the request is processed.
 */
@Override
public void afterCompletion(WebRequest request, Exception ex) throws Exception {
	NDC.pop();
	if (NDC.getDepth() == 0) {
		NDC.remove();
	}
}
 
/**
 * Removes the log message from the Log4J NDC when the processing thread is
 * exited after the start of asynchronous request handling.
 */
@Override
public void afterConcurrentHandlingStarted(WebRequest request) {
	NDC.pop();
	if (NDC.getDepth() == 0) {
		NDC.remove();
	}
}
 
/**
 * Removes the log message from the Log4J NDC after the request is processed
 * and logs the after-request message through Log4J.
 */
@Override
protected void afterRequest(HttpServletRequest request, String message) {
	NDC.pop();
	if (NDC.getDepth() == 0) {
		NDC.remove();
	}
	if (log4jLogger.isDebugEnabled()) {
		log4jLogger.debug(message);
	}
}