當前位置: 首頁>>代碼示例>>Java>>正文


Java Logger.isInfoEnabled方法代碼示例

本文整理匯總了Java中org.apache.log4j.Logger.isInfoEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java Logger.isInfoEnabled方法的具體用法?Java Logger.isInfoEnabled怎麽用?Java Logger.isInfoEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.log4j.Logger的用法示例。


在下文中一共展示了Logger.isInfoEnabled方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: logXml

import org.apache.log4j.Logger; //導入方法依賴的package包/類
public static void logXml(Document document, Logger log, String message) {
	if (document != null && log.isInfoEnabled()) {
		String xml = XMLUtils.prettyPrintDOM(document);

		if (xml.length() > XMLUtils.MAX_XML_SIZE_FOR_LOG_INFO * 1000) {
			if (!log.isDebugEnabled()) {
				log.info(message
						+ "\n[XML size is > " + XMLUtils.MAX_XML_SIZE_FOR_LOG_INFO
						+ "KB, enable DEBUG log level for this logger to see it completly!]\n"
						+ "[Extract limited to the first " + XMLUtils.MAX_XML_SIZE_FOR_LOG_INFO + "KB]\n"
						+ xml.substring(0, XMLUtils.MAX_XML_SIZE_FOR_LOG_INFO * 1000)
						+ "... (see the complete message in DEBUG log level)");
			}
			log.debug(message + ":\n" + xml);
		} else {
			log.info(message + ":\n" + xml);
		}
	}
}
 
開發者ID:convertigo,項目名稱:convertigo-engine,代碼行數:20,代碼來源:XMLUtils.java

示例2: execute

import org.apache.log4j.Logger; //導入方法依賴的package包/類
@Override
public boolean execute(Context javascriptContext, Scriptable scope) throws EngineException {
	if (isEnabled()) {
		if (super.execute(javascriptContext, scope)) {
			Logger log = engine ? Engine.logEngine : Engine.logContext;
			if(level.equals(Level.WARN.toString()) && log.isEnabledFor(Level.WARN))
				log.warn(getEvalString(javascriptContext, scope));
			else if(level.equals(Level.INFO.toString()) && log.isInfoEnabled())
				log.info(getEvalString(javascriptContext, scope));
			else if(level.equals(Level.DEBUG.toString()) && log.isDebugEnabled())
				log.debug(getEvalString(javascriptContext, scope));
			else if(level.equals(Level.TRACE.toString()) && log.isTraceEnabled())
				log.trace(getEvalString(javascriptContext, scope));
			else if(level.equals(Level.ERROR.toString()) && log.isEnabledFor(Level.ERROR))
				log.error(getEvalString(javascriptContext, scope));
			return true;
		}
	}
	return false;
}
 
開發者ID:convertigo,項目名稱:convertigo-engine,代碼行數:21,代碼來源:LogStatement.java

示例3: stepExecute

import org.apache.log4j.Logger; //導入方法依賴的package包/類
@Override
protected boolean stepExecute(Context javascriptContext, Scriptable scope) throws EngineException {
	if (isEnabled()) {
		if (super.stepExecute(javascriptContext, scope)) {
			Logger log = null;
			if(logger.equals(Engine.logEngine.getName())) 
				log = Engine.logEngine;
			else if(logger.equals(Engine.logContext.getName()))
				log = Engine.logContext;
			else if(logger.equals(Engine.logUser.getName()))
				log = Engine.logUser;
			else if(logger.equals(Engine.logAudit.getName())) 
				log = Engine.logAudit;
			if(level.equals(Level.WARN.toString()) && log.isEnabledFor(Level.WARN))
				log.warn(getEvalString(javascriptContext, scope));
			else if(level.equals(Level.INFO.toString()) && log.isInfoEnabled())
				log.info(getEvalString(javascriptContext, scope));
			else if(level.equals(Level.DEBUG.toString()) && log.isDebugEnabled())
				log.debug(getEvalString(javascriptContext, scope));
			else if(level.equals(Level.TRACE.toString()) && log.isTraceEnabled())
				log.trace(getEvalString(javascriptContext, scope));
			else if(level.equals(Level.ERROR.toString()) && log.isEnabledFor(Level.ERROR))
				log.error(getEvalString(javascriptContext, scope));
			return true;
		}
	}
	return false;
}
 
開發者ID:convertigo,項目名稱:convertigo-engine,代碼行數:29,代碼來源:LogStep.java


注:本文中的org.apache.log4j.Logger.isInfoEnabled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。