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


Java Logger.isDebugEnabled方法代码示例

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


在下文中一共展示了Logger.isDebugEnabled方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: OldSolverManagerSolver

import org.apache.log4j.Logger; //导入方法依赖的package包/类
/**
    * Creates a new Solver Manager object and initializes it with a stream that
    * collects the logging informations if wanted.
    */
   public OldSolverManagerSolver(SolverManager solverManager) {
this.solverManager = solverManager;
Logger logger = TesttoolConfig.getLogger();

if (logger.isDebugEnabled()) logger.debug("SolverManager started");

substitutionTable = new SubstitutionTable();
constraintStack = new ConstraintStack();
solverChooser = new SolverChooser(solverManager);

SolverManagerConfig solverConf = SolverManagerConfig.getInstance();
listeners = new SolverManagerListenerList();
for (SolverManagerListener listener : solverConf.getListeners()){
    listeners.addListener(listener);
    logger.debug("OldSolverManagerSolver: added listener " + listener.getClass().getName());
}
   }
 
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:22,代码来源:OldSolverManagerSolver.java

示例4: 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

示例5: printStack

import org.apache.log4j.Logger; //导入方法依赖的package包/类
public void printStack(Logger solverLogger){
if (solverLogger.isDebugEnabled()) {
    ConstraintStackElement current = bottom;
    if (current == null)
	solverLogger.debug("<stack is empty>"); // Changed 2008.02.05
    else {
	int idx = 0;
	while (current != null){
	    solverLogger.debug("stack element nr " + idx++ + " : " + current.expression); // Changed 2008.02.05
	    solverLogger.debug(" " + current.solutionCache.toString()); // Changed 2008.02.05
	    solverLogger.debug(" first noncontradictory system: " + current.getFirstNoncontradictorySystemIndex()); // Changed 2008.02.05
	    for (int systemIdx = 0; systemIdx < current.getNodeSystemCount(); systemIdx++){
		if (current.getNodeSystemCount() > 1)
		    solverLogger.debug("  system " + systemIdx); // Changed 2008.02.05
		ConstraintSystem system = current.getNodeSystem(systemIdx);
		for (int setIdx = 0; setIdx < system.getConstraintSetCount(); setIdx++){
		    if (system.getConstraintSetCount() > 1)
			solverLogger.debug("    set " + setIdx); // Changed 2008.02.05
		    SingleConstraintSet set = system.getConstraintSet(setIdx);
		    for (int constraintIdx = 0; constraintIdx < set.getConstraintCount(); constraintIdx++)
			solverLogger.debug("      " + set.getConstraint(constraintIdx)); // Changed 2008.02.05
		}
	    }
	    current = current.next;
	}
    }
}
   }
 
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:29,代码来源:ConstraintStack.java

示例6: extractUserParameter

import org.apache.log4j.Logger; //导入方法依赖的package包/类
protected boolean extractUserParameter(
                                        String description,
                                        String valueToMatch,
                                        String text ) throws XmlUtilitiesException {

    Logger log = Logger.getLogger(this.getClass());

    // apply the current user parameters
    valueToMatch = XmlUtilities.applyUserParameters(valueToMatch);

    //FIXME: Limited to one variable only
    int findex = valueToMatch.indexOf("${=") + "${=".length();
    String userParameterName = valueToMatch.substring(findex, valueToMatch.indexOf("}", findex));

    // TODO check the regex accuracy. currently escaped *, ., *, ^, -, ?  and $, {, }
    String patternToMatch = valueToMatch.replace("(", "\\(")
                                        .replace(")", "\\)")
                                        .replace("*", "\\*")
                                        .replace(".", "\\.")
                                        .replace("^", "\\^")
                                        .replace("-", "\\-")
                                        .replace("|", "\\|")
                                        .replace("?", "\\?")
                                        .replaceAll("\\$\\{\\=.*\\}", "(.*)");
    // escape $ { and }, and ${RANDOM} after we have replaced ${=...}
    patternToMatch = patternToMatch.replace("${RANDOM}", ".*")
                                   // match this place as value for the variable
                                   .replace("$", "\\$")
                                   .replace("{", "\\{")
                                   .replace("}", "\\}");

    Matcher matcher = Pattern.compile(patternToMatch).matcher(text);
    if (matcher.find() && matcher.groupCount() == 1) {
        String userParameterValue = matcher.group(1);
        if (log.isDebugEnabled()) {
            log.debug("Extracted new user parameter from " + description + ": '" + userParameterName
                      + "' = '" + userParameterValue + "'");
        }
        ThreadContext.setAttribute(userParameterName, userParameterValue);
        return true;
    } else {
        log.error("Could not extract the expected user parameter '" + userParameterName + "' from "
                  + text + " for " + toString());
        return false;
    }
}
 
开发者ID:Axway,项目名称:ats-framework,代码行数:47,代码来源:ResponseMatcher.java


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