org.apache.commons.logging.LogFactory.isDiagnosticsEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中org.apache.commons.logging.LogFactory.isDiagnosticsEnabled()方法的一些代码示例,展示了LogFactory.isDiagnosticsEnabled()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LogFactory.isDiagnosticsEnabled()方法的具体详情如下:
包路径:org.apache.commons.logging.LogFactory
类名称:LogFactory
方法名:isDiagnosticsEnabled

LogFactory.isDiagnosticsEnabled介绍

[英]Indicates true if the user has enabled internal logging.

By the way, sorry for the incorrect grammar, but calling this method areDiagnosticsEnabled just isn't java beans style.
[中]如果用户已启用内部日志记录,则指示true。
顺便说一句,很抱歉语法不正确,但是调用此方法areDiagnosticsEnabled并不是JavaBeans风格。

代码示例

代码示例来源:origin: commons-logging/commons-logging

/**
 * Workaround for bug in Java1.2; in theory this method is not needed.
 * See LogFactory.isDiagnosticsEnabled.
 */
protected static boolean isDiagnosticsEnabled() {
  return LogFactory.isDiagnosticsEnabled();
}

代码示例来源:origin: robovm/robovm

/**
 * Workaround for bug in Java1.2; in theory this method is not needed.
 * See LogFactory.isDiagnosticsEnabled.
 */
protected static boolean isDiagnosticsEnabled() {
  return LogFactory.isDiagnosticsEnabled();
}

代码示例来源:origin: commons-logging/commons-logging

public Object run() {
    try {
      if (loader != null) {
        return loader.getResources(name);
      } else {
        return ClassLoader.getSystemResources(name);
      }
    } catch (IOException e) {
      if (isDiagnosticsEnabled()) {
        logDiagnostic("Exception while trying to find configuration file " +
               name + ":" + e.getMessage());
      }
      return null;
    } catch (NoSuchMethodError e) {
      // we must be running on a 1.1 JVM which doesn't support
      // ClassLoader.getSystemResources; just return null in
      // this case.
      return null;
    }
  }
};

代码示例来源:origin: commons-logging/commons-logging

if (isDiagnosticsEnabled()) {
  logDiagnostic("Unable to read URL " + url);
  } catch (IOException e) {
    if (isDiagnosticsEnabled()) {
      logDiagnostic("Unable to close stream for URL " + url);

代码示例来源:origin: robovm/robovm

public Object run() {
    try {
      InputStream stream = url.openStream();
      if (stream != null) {
        Properties props = new Properties();
        props.load(stream);
        stream.close();
        return props;
      }
    } catch(IOException e) {
      if (isDiagnosticsEnabled()) {
        logDiagnostic("Unable to read URL " + url);
      }
    }
    return null;
  }
};

代码示例来源:origin: robovm/robovm

public Object run() {
    try {
      if (loader != null) {
        return loader.getResources(name);
      } else {
        return ClassLoader.getSystemResources(name);
      }
    } catch(IOException e) {
      if (isDiagnosticsEnabled()) {
        logDiagnostic(
          "Exception while trying to find configuration file "
          + name + ":" + e.getMessage());
      }
      return null;
    } catch(NoSuchMethodError e) {
      // we must be running on a 1.1 JVM which doesn't support
      // ClassLoader.getSystemResources; just return null in
      // this case.
      return null;
    }
  }
};

代码示例来源:origin: commons-logging/commons-logging

return clazz.getClassLoader();
} catch (SecurityException ex) {
  if (isDiagnosticsEnabled()) {
    logDiagnostic("Unable to get classloader for class '" + clazz +
           "' due to security restrictions - " + ex.getMessage());

代码示例来源:origin: commons-logging/commons-logging

/**
 * Release any internal references to previously created {@link LogFactory}
 * instances, after calling the instance method <code>release()</code> on
 * each of them.  This is useful in environments like servlet containers,
 * which implement application reloading by throwing away a ClassLoader.
 * Dangling references to objects in that class loader would prevent
 * garbage collection.
 */
public static void releaseAll() {
  if (isDiagnosticsEnabled()) {
    logDiagnostic("Releasing factory for all classloaders.");
  }
  // factories is not final and could be replaced in this block.
  final Hashtable factories = LogFactory.factories;
  synchronized (factories) {
    final Enumeration elements = factories.elements();
    while (elements.hasMoreElements()) {
      LogFactory element = (LogFactory) elements.nextElement();
      element.release();
    }
    factories.clear();
    if (nullClassLoaderFactory != null) {
      nullClassLoaderFactory.release();
      nullClassLoaderFactory = null;
    }
  }
}

代码示例来源:origin: robovm/robovm

return clazz.getClassLoader();
} catch(SecurityException ex) {
  if (isDiagnosticsEnabled()) {
    logDiagnostic(
        "Unable to get classloader for class '" + clazz

代码示例来源:origin: robovm/robovm

if (isDiagnosticsEnabled()) {

代码示例来源:origin: commons-logging/commons-logging

if (!isDiagnosticsEnabled()) {
  return;

代码示例来源:origin: commons-logging/commons-logging

if (isDiagnosticsEnabled()) {

代码示例来源:origin: commons-logging/commons-logging

if (isDiagnosticsEnabled()) {
          logDiagnostic("[LOOKUP] Properties file found at '" + url + "'" +
                 " with priority " + priority);
          if (isDiagnosticsEnabled()) {
            logDiagnostic("[LOOKUP] Properties file at '" + url + "'" +
                   " with priority " + newPriority +
          priority = newPriority;
        } else {
          if (isDiagnosticsEnabled()) {
            logDiagnostic("[LOOKUP] Properties file at '" + url + "'" +
                   " with priority " + newPriority +
  if (isDiagnosticsEnabled()) {
    logDiagnostic("SecurityException thrown while trying to find/read config files.");
if (isDiagnosticsEnabled()) {
  if (props == null) {
    logDiagnostic("[LOOKUP] No properties file of name '" + fileName + "' found.");

代码示例来源:origin: robovm/robovm

/**
 * Release any internal references to previously created {@link LogFactory}
 * instances, after calling the instance method <code>release()</code> on
 * each of them.  This is useful in environments like servlet containers,
 * which implement application reloading by throwing away a ClassLoader.
 * Dangling references to objects in that class loader would prevent
 * garbage collection.
 */
public static void releaseAll() {
  if (isDiagnosticsEnabled()) {
    logDiagnostic("Releasing factory for all classloaders.");
  }
  synchronized (factories) {
    Enumeration elements = factories.elements();
    while (elements.hasMoreElements()) {
      LogFactory element = (LogFactory) elements.nextElement();
      element.release();
    }
    factories.clear();
    if (nullClassLoaderFactory != null) {
      nullClassLoaderFactory.release();
      nullClassLoaderFactory = null;
    }
  }
}

代码示例来源:origin: commons-logging/commons-logging

/**
 * Release any internal references to previously created {@link LogFactory}
 * instances that have been associated with the specified class loader
 * (if any), after calling the instance method <code>release()</code> on
 * each of them.
 *
 * @param classLoader ClassLoader for which to release the LogFactory
 */
public static void release(ClassLoader classLoader) {
  if (isDiagnosticsEnabled()) {
    logDiagnostic("Releasing factory for classloader " + objectId(classLoader));
  }
  // factories is not final and could be replaced in this block.
  final Hashtable factories = LogFactory.factories;
  synchronized (factories) {
    if (classLoader == null) {
      if (nullClassLoaderFactory != null) {
        nullClassLoaderFactory.release();
        nullClassLoaderFactory = null;
      }
    } else {
      final LogFactory factory = (LogFactory) factories.get(classLoader);
      if (factory != null) {
        factory.release();
        factories.remove(classLoader);
      }
    }
  }
}

代码示例来源:origin: robovm/robovm

if (!isDiagnosticsEnabled()) {
  return;

代码示例来源:origin: commons-logging/commons-logging

if (isDiagnosticsEnabled()) {
    logDiagnostic("An error occurred while loading the factory class:" + ex.getMessage());
if (isDiagnosticsEnabled()) {
  logDiagnostic("Created object " + objectId(result) + " to manage classloader " +
         objectId(contextClassLoader));

代码示例来源:origin: robovm/robovm

/**
 * Release any internal references to previously created {@link LogFactory}
 * instances that have been associated with the specified class loader
 * (if any), after calling the instance method <code>release()</code> on
 * each of them.
 *
 * @param classLoader ClassLoader for which to release the LogFactory
 */
public static void release(ClassLoader classLoader) {
  if (isDiagnosticsEnabled()) {
    logDiagnostic("Releasing factory for classloader " + objectId(classLoader));
  }
  synchronized (factories) {
    if (classLoader == null) {
      if (nullClassLoaderFactory != null) {
        nullClassLoaderFactory.release();
        nullClassLoaderFactory = null;
      }
    } else {
      LogFactory factory = (LogFactory) factories.get(classLoader);
      if (factory != null) {
        factory.release();
        factories.remove(classLoader);
      }
    }
  }
}

代码示例来源:origin: commons-logging/commons-logging

if (!isDiagnosticsEnabled()) {
  return;

代码示例来源:origin: robovm/robovm

if (!isDiagnosticsEnabled()) {
  return;

相关文章