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


Java Log.isDebugEnabled方法代码示例

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


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

示例1: logFailedRequest

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
 * Logs a request that failed
 */
static void logFailedRequest(Log logger, HttpUriRequest request, HttpHost host, Exception e) {
    if (logger.isDebugEnabled()) {
        logger.debug("request [" + request.getMethod() + " " + host + getUri(request.getRequestLine()) + "] failed", e);
    }
    if (tracer.isTraceEnabled()) {
        String traceRequest;
        try {
            traceRequest = buildTraceRequest(request, host);
        } catch (IOException e1) {
            tracer.trace("error while reading request for trace purposes", e);
            traceRequest = "";
        }
        tracer.trace(traceRequest);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:19,代码来源:RequestLogger.java

示例2: internalGenerate

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
 * Generates the form.
 * 
 * @param item The object to generate a form for
 * @param fields Restricted list of fields to include
 * @param forcedFields List of fields to forcibly include
 * @param form The form object being generated
 * @param context Map representing optional context that can be used during
 *            retrieval of the form
 */
protected void internalGenerate(ItemType item, List<String> fields, List<String> forcedFields, Form form, Map<String, Object> context)
{
    Log log = getLogger();
    if (log.isDebugEnabled()) log.debug("Generating form for: " + item);

    // generate the form type and URI for the item.
    Item formItem = form.getItem();
    formItem.setType(getItemType(item));
    formItem.setUrl(getItemURI(item));

    Object itemData = makeItemData(item);
    FormCreationData data = new FormCreationDataImpl(itemData, forcedFields, context); 
    populateForm(form, fields, data);
    if (log.isDebugEnabled()) //
        log.debug("Generated form: " + form);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:FilteredFormProcessor.java

示例3: isBlacklisted

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
public static  boolean isBlacklisted(FiCaSchedulerApp application,
    FiCaSchedulerNode node, Log LOG) {
  if (application.isBlacklisted(node.getNodeName())) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Skipping 'host' " + node.getNodeName() + 
          " for " + application.getApplicationId() + 
          " since it has been blacklisted");
    }
    return true;
  }

  if (application.isBlacklisted(node.getRackName())) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Skipping 'rack' " + node.getRackName() + 
          " for " + application.getApplicationId() + 
          " since it has been blacklisted");
    }
    return true;
  }

  return false;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:FiCaSchedulerUtils.java

示例4: isBlacklisted

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
public static  boolean isBlacklisted(SchedulerApplicationAttempt application,
    SchedulerNode node, Log LOG) {
  if (application.isBlacklisted(node.getNodeName())) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Skipping 'host' " + node.getNodeName() +
          " for " + application.getApplicationId() +
          " since it has been blacklisted");
    }
    return true;
  }

  if (application.isBlacklisted(node.getRackName())) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Skipping 'rack' " + node.getRackName() +
          " for " + application.getApplicationId() +
          " since it has been blacklisted");
    }
    return true;
  }

  return false;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:SchedulerAppUtils.java

示例5: getPrimitiveType

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
 * Gets the class for the primitive type corresponding to the primitive wrapper class given.
 * For example, an instance of <code>Boolean.class</code> returns a <code>boolean.class</code>.
 * @param wrapperType the
 * @return the primitive type class corresponding to the given wrapper class,
 * null if no match is found
 */
public static Class<?> getPrimitiveType(final Class<?> wrapperType) {
    // does anyone know a better strategy than comparing names?
    if (Boolean.class.equals(wrapperType)) {
        return boolean.class;
    } else if (Float.class.equals(wrapperType)) {
        return float.class;
    } else if (Long.class.equals(wrapperType)) {
        return long.class;
    } else if (Integer.class.equals(wrapperType)) {
        return int.class;
    } else if (Short.class.equals(wrapperType)) {
        return short.class;
    } else if (Byte.class.equals(wrapperType)) {
        return byte.class;
    } else if (Double.class.equals(wrapperType)) {
        return double.class;
    } else if (Character.class.equals(wrapperType)) {
        return char.class;
    } else {
        final Log log = LogFactory.getLog(MethodUtils.class);
        if (log.isDebugEnabled()) {
            log.debug("Not a known primitive wrapper class: " + wrapperType);
        }
        return null;
    }
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:34,代码来源:MethodUtils.java

示例6: cleanup

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
 * Close the Closeable objects and <b>ignore</b> any {@link IOException} or 
 * null pointers. Must only be used for cleanup in exception handlers.
 *
 * @param log the log to record problems to at debug level. Can be null.
 * @param closeables the objects to close
 */
public static void cleanup(Log log, java.io.Closeable... closeables) {
  for (java.io.Closeable c : closeables) {
    if (c != null) {
      try {
        c.close();
      } catch(Throwable e) {
        if (log != null && log.isDebugEnabled()) {
          log.debug("Exception in closing " + c, e);
        }
      }
    }
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:21,代码来源:IOUtils.java

示例7: cleanup

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
 * Close the Closeable objects and <b>ignore</b> any {@link IOException} or 
 * null pointers. Must only be used for cleanup in exception handlers.
 * @param log the log to record problems to at debug level. Can be null.
 * @param closeables the objects to close
 */
public static void cleanup(Log log, Closeable... closeables) {
  for(Closeable c : closeables) {
    if (c != null) {
      try {
        c.close();
      } catch(IOException e) {
        if (log != null && log.isDebugEnabled()) {
          log.debug("Exception in closing " + c, e);
        }
      }
    }
  }
}
 
开发者ID:spafka,项目名称:spark_deep,代码行数:20,代码来源:IOUtils.java

示例8: cleanup

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
 * Close the Closeable objects and <b>ignore</b> any {@link IOException} or 
 * null pointers. Must only be used for cleanup in exception handlers.
 *
 * @param log the log to record problems to at debug level. Can be null.
 * @param closeables the objects to close
 */
public static void cleanup(Log log, java.io.Closeable... closeables) {
  for (java.io.Closeable c : closeables) {
    if (c != null) {
      try {
        c.close();
      } catch(IOException e) {
        if (log != null && log.isDebugEnabled()) {
          log.debug("Exception in closing " + c, e);
        }
      }
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:IOUtils.java

示例9: LoggingStateChangeListener

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
 * Log events to the given log
 * @param log destination for events
 */
public LoggingStateChangeListener(Log log) {
  //force an NPE if a null log came in
  log.isDebugEnabled();
  this.log = log;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:10,代码来源:LoggingStateChangeListener.java

示例10: initWebApplicationContext

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
 * Initialize Spring's web application context for the given servlet context,
 * using the application context provided at construction time, or creating a new one
 * according to the "{@link #CONTEXT_CLASS_PARAM contextClass}" and
 * "{@link #CONFIG_LOCATION_PARAM contextConfigLocation}" context-params.
 * @param servletContext current servlet context
 * @return the new WebApplicationContext
 * @see #ContextLoader(WebApplicationContext)
 * @see #CONTEXT_CLASS_PARAM
 * @see #CONFIG_LOCATION_PARAM
 */
public WebApplicationContext initWebApplicationContext(ServletContext servletContext) {
	if (servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE) != null) {
		throw new IllegalStateException(
				"Cannot initialize context because there is already a root application context present - " +
				"check whether you have multiple ContextLoader* definitions in your web.xml!");
	}

	Log logger = LogFactory.getLog(ContextLoader.class);
	servletContext.log("Initializing Spring root WebApplicationContext");
	if (logger.isInfoEnabled()) {
		logger.info("Root WebApplicationContext: initialization started");
	}
	long startTime = System.currentTimeMillis();

	try {
		// Store context in local instance variable, to guarantee that
		// it is available on ServletContext shutdown.
		if (this.context == null) {
			this.context = createWebApplicationContext(servletContext);
		}
		if (this.context instanceof ConfigurableWebApplicationContext) {
			ConfigurableWebApplicationContext cwac = (ConfigurableWebApplicationContext) this.context;
			if (!cwac.isActive()) {
				// The context has not yet been refreshed -> provide services such as
				// setting the parent context, setting the application context id, etc
				if (cwac.getParent() == null) {
					// The context instance was injected without an explicit parent ->
					// determine parent for root web application context, if any.
					ApplicationContext parent = loadParentContext(servletContext);
					cwac.setParent(parent);
				}
				configureAndRefreshWebApplicationContext(cwac, servletContext);
			}
		}
		servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, this.context);

		ClassLoader ccl = Thread.currentThread().getContextClassLoader();
		if (ccl == ContextLoader.class.getClassLoader()) {
			currentContext = this.context;
		}
		else if (ccl != null) {
			currentContextPerThread.put(ccl, this.context);
		}

		if (logger.isDebugEnabled()) {
			logger.debug("Published root WebApplicationContext as ServletContext attribute with name [" +
					WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE + "]");
		}
		if (logger.isInfoEnabled()) {
			long elapsedTime = System.currentTimeMillis() - startTime;
			logger.info("Root WebApplicationContext: initialization completed in " + elapsedTime + " ms");
		}

		return this.context;
	}
	catch (RuntimeException ex) {
		logger.error("Context initialization failed", ex);
		servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ex);
		throw ex;
	}
	catch (Error err) {
		logger.error("Context initialization failed", err);
		servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, err);
		throw err;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:78,代码来源:ContextLoader.java

示例11: debug

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
 * Sprintf() to the log iff the log is at debug level. If the log
 * is not at debug level, the printf operation is skipped, so
 * no time is spent generating the string.
 * @param log log to use
 * @param text text message
 * @param args args arguments to the print statement
 */
public static void debug(Log log, String text, Object... args) {
  if (log.isDebugEnabled()) {
    log.debug(String.format(text, args));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:SwiftUtils.java

示例12: debugEx

import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
 * Log an exception (in text and trace) iff the log is at debug
 * @param log Log to use
 * @param text text message
 * @param ex exception
 */
public static void debugEx(Log log, String text, Exception ex) {
  if (log.isDebugEnabled()) {
    log.debug(text + ex, ex);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:SwiftUtils.java


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