本文整理汇总了Java中org.apache.commons.logging.Log.debug方法的典型用法代码示例。如果您正苦于以下问题:Java Log.debug方法的具体用法?Java Log.debug怎么用?Java Log.debug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.logging.Log
的用法示例。
在下文中一共展示了Log.debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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);
}
示例3: oneTimeLiveLog
import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
* Logs each method routing path once per session.
*
* @param logger
* @param route
*/
static void oneTimeLiveLog(Log logger, ExtensionRoute route)
{
synchronized (AJExtender.class)
{
if (oneTimeLogSet == null)
{
oneTimeLogSet = new ConcurrentHashSet<>();
}
}
synchronized (oneTimeLogSet)
{
if (oneTimeLogSet.contains(route))
{
return;
}
else
{
logger.debug(route.toString());
oneTimeLogSet.add(route);
}
}
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
}
示例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, 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);
}
}
}
}
}
示例8: onLogException
import org.apache.commons.logging.Log; //导入方法依赖的package包/类
@Override
public boolean onLogException(Log logger, Throwable t, String message)
{
if(t instanceof ActionCancelledException || t instanceof DisabledReplicationJobException)
{
logger.debug(message);
return true;
}
return false;
}
示例9: onLogException
import org.apache.commons.logging.Log; //导入方法依赖的package包/类
@Override
public boolean onLogException(Log logger, Throwable t, String message)
{
if (t instanceof UnimportantTransformException )
{
logger.debug(message);
return true;
}
else if (t instanceof UnsupportedTransformationException)
{
logger.error(message);
return true;
}
return false;
}
示例10: 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);
}
}
}
}
}
示例11: 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);
}
}
}
}
}
示例12: logFSTree
import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
* Recursive helper to log the state of the FS
*
* @see #logFileSystemState(FileSystem, Path, Log)
*/
private static void logFSTree(Log LOG, final FileSystem fs, final Path root, String prefix)
throws IOException {
FileStatus[] files = FSUtils.listStatus(fs, root, null);
if (files == null) return;
for (FileStatus file : files) {
if (file.isDirectory()) {
LOG.debug(prefix + file.getPath().getName() + "/");
logFSTree(LOG, fs, file.getPath(), prefix + "---");
} else {
LOG.debug(prefix + file.getPath().getName());
}
}
}
示例13: setMethodAccessible
import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
* Try to make the method accessible
* @param method The source arguments
*/
private static void setMethodAccessible(final Method method) {
try {
//
// XXX Default access superclass workaround
//
// When a public class has a default access superclass
// with public methods, these methods are accessible.
// Calling them from compiled code works fine.
//
// Unfortunately, using reflection to invoke these methods
// seems to (wrongly) to prevent access even when the method
// modifer is public.
//
// The following workaround solves the problem but will only
// work from sufficiently privilages code.
//
// Better workarounds would be greatfully accepted.
//
if (!method.isAccessible()) {
method.setAccessible(true);
}
} catch (final SecurityException se) {
// log but continue just in case the method.invoke works anyway
final Log log = LogFactory.getLog(MethodUtils.class);
if (!loggedAccessibleWarning) {
boolean vulnerableJVM = false;
try {
final String specVersion = System.getProperty("java.specification.version");
if (specVersion.charAt(0) == '1' &&
(specVersion.charAt(2) == '0' ||
specVersion.charAt(2) == '1' ||
specVersion.charAt(2) == '2' ||
specVersion.charAt(2) == '3')) {
vulnerableJVM = true;
}
} catch (final SecurityException e) {
// don't know - so display warning
vulnerableJVM = true;
}
if (vulnerableJVM) {
log.warn(
"Current Security Manager restricts use of workarounds for reflection bugs "
+ " in pre-1.4 JVMs.");
}
loggedAccessibleWarning = true;
}
log.debug("Cannot setAccessible on method. Therefore cannot use jvm access bug workaround.", se);
}
}
示例14: 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;
}
}
示例15: debug
import org.apache.commons.logging.Log; //导入方法依赖的package包/类
/**
* Log an I18Nized message to DEBUG.
*
* @param logger the logger to use
* @param messageKey the message key
* @param args the required message arguments
*/
public static final void debug(Log logger, String messageKey, Object ... args)
{
logger.debug(I18NUtil.getMessage(messageKey, args));
}