Tabnine Logo
LogFactory
Code IndexAdd Tabnine to your IDE (free)

How to use
LogFactory
in
org.apache.commons.logging

Best Java code snippets using org.apache.commons.logging.LogFactory (Showing top 20 results out of 6,462)

origin: spring-projects/spring-framework

/**
 * Set the log category for warn logging.
 * <p>Default is no warn logging. Specify this setting to activate warn
 * logging into a specific category.
 * @since 5.1
 * @see org.apache.commons.logging.LogFactory#getLog(String)
 * @see java.util.logging.Logger#getLogger(String)
 */
public void setWarnLogCategory(String loggerName) {
  this.warnLogger = LogFactory.getLog(loggerName);
}
origin: commons-logging/commons-logging

/**
 * Convenience method to return a named logger, without the application
 * having to care about factories.
 *
 * @param clazz Class from which a log name will be derived
 * @throws LogConfigurationException if a suitable <code>Log</code>
 *  instance cannot be returned
 */
public static Log getLog(Class clazz) throws LogConfigurationException {
  return getFactory().getInstance(clazz);
}
origin: jenkinsci/jenkins

/**
 * Orderly terminates all the plugins.
 */
public void stop() {
  for (PluginWrapper p : activePlugins) {
    p.stop();
    p.releaseClassLoader();
  }
  activePlugins.clear();
  // Work around a bug in commons-logging.
  // See http://www.szegedi.org/articles/memleak.html
  LogFactory.release(uberClassLoader);
}
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: 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: org.jboss.logging/commons-logging-jboss-logging

/**
 * Release any internal references to previously created {@link org.apache.commons.logging.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() {
  getFactory().release();
}
origin: jboss.jbossts/jbossjts

  /**
   * Restore the factory configuration to the provided value.
   */
  private void resetFactory(Object value)
  {
      org.apache.commons.logging.LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log", value);
  }
}
origin: org.apache.poi/poi

@Override
public void initialize(final String cat)
{
  this.log = _creator.getInstance(cat);
}   
 
origin: jboss.jbossts/jbossjts

/**
* Install our custom logger by setting the factory attribute
*/
private Object configureFactory()
{
  Object oldValue = org.apache.commons.logging.LogFactory.getFactory().getAttribute("org.apache.commons.logging.Log");
  org.apache.commons.logging.LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log", logImpl);
  return oldValue;
}
origin: se.vgregion.HsaTools/HsaTools-Mocks

/**
 * Creates an instance of the LogFactoryMock and sets the system property LogFactory looks at to find the correct LogFactory to return when a factory is requested and releases all instances to make
 * sure that a LogFactoryMock is returned.
 * 
 * @return An instance of LogFactoryMock.
 */
public static LogFactoryMock createInstance() {
 LogFactoryMock.resetInstance();
 System.setProperty("org.apache.commons.logging.LogFactory", "se.vgregion.kivtools.mocks.LogFactoryMock");
 LogFactory.releaseAll();
 return (LogFactoryMock) LogFactory.getFactory();
}
origin: org.jboss.logmanager/commons-logging-jboss-logmanager

/**
 * 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) {
  getFactory().release();
}
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: apache/fop

/**
 * Sets the logging level.
 * @param level the logging level ("debug", "info", "error" etc., see Jakarta Commons Logging)
 */
protected static void setLogLevel(String level) {
  // Set the evel for future loggers.
  LogFactory.getFactory().setAttribute("level", level);
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

@Override
public void initialize(final String cat)
{
  this.log = _creator.getInstance(cat);
}   
 
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: spring-projects/spring-framework

/**
 * Set the name of the logger to use.
 * The name will be passed to the underlying logger implementation through Commons Logging,
 * getting interpreted as log category according to the logger's configuration.
 * <p>This can be specified to not log into the category of this warner class but rather
 * into a specific named category.
 * @see org.apache.commons.logging.LogFactory#getLog(String)
 * @see java.util.logging.Logger#getLogger(String)
 */
public void setLoggerName(String loggerName) {
  this.logger = LogFactory.getLog(loggerName);
}
origin: commons-logging/commons-logging

/**
 * Convenience method to return a named logger, without the application
 * having to care about factories.
 *
 * @param name Logical name of the <code>Log</code> instance to be
 *  returned (the meaning of this name is only known to the underlying
 *  logging implementation that is being wrapped)
 * @throws LogConfigurationException if a suitable <code>Log</code>
 *  instance cannot be returned
 */
public static Log getLog(String name) throws LogConfigurationException {
  return getFactory().getInstance(name);
}
origin: org.jboss.logmanager/commons-logging-jboss-logmanager

/**
 * 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() {
  getFactory().release();
}
origin: jenkinsci/jenkins

/**
 * Terminates the plugin.
 */
public void stop() {
  Plugin plugin = getPlugin();
  if (plugin != null) {
    try {
      LOGGER.log(Level.FINE, "Stopping {0}", shortName);
      plugin.stop();
    } catch (Throwable t) {
      LOGGER.log(WARNING, "Failed to shut down " + shortName, t);
    }
  } else {
    LOGGER.log(Level.FINE, "Could not find Plugin instance to stop for {0}", shortName);
  }
  // Work around a bug in commons-logging.
  // See http://www.szegedi.org/articles/memleak.html
  LogFactory.release(classLoader);
}
origin: camunda/camunda-bpm-platform

/**
 * 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);
      }
    }
  }
}
org.apache.commons.loggingLogFactory

Javadoc

Factory for creating Log instances, with discovery and configuration features similar to that employed by standard Java APIs such as JAXP.

IMPLEMENTATION NOTE - This implementation is heavily based on the SAXParserFactory and DocumentBuilderFactory implementations (corresponding to the JAXP pluggability APIs) found in Apache Xerces.

Most used methods

  • getLog
    Convenience method to return a named logger.
  • getFactory
    This method only exists for compatibility with unusual Commons Logging API usage like e.g. LogFactor
  • release
    Release any internal references to previously created LogFactoryinstances that have been associated
  • getInstance
    Convenience method to return a named logger.This variant just dispatches straight to #getLog(String)
  • setAttribute
    Set the configuration attribute with the specified name. Calling this with a null value is equivale
  • releaseAll
    Release any internal references to previously created LogFactoryinstances, after calling the instanc
  • cacheFactory
    Remember this factory, so later calls to LogFactory.getCachedFactory can return the previously creat
  • createFactory
    This method exists to ensure signature compatibility.
  • directGetContextClassLoader
    This method exists to ensure signature compatibility.
  • getCachedFactory
    Check cached factories (keyed by contextClassLoader)
  • getClassLoader
    This method exists to ensure signature compatibility.
  • getConfigurationFile
    Locate a user-provided configuration file. The classpath of the specified classLoader (usually the c
  • getClassLoader,
  • getConfigurationFile,
  • getContextClassLoader,
  • getProperties,
  • getResourceAsStream,
  • getResources,
  • implementsLogFactory,
  • isDiagnosticsEnabled,
  • logDiagnostic,
  • logHierarchy

Popular in Java

  • Making http requests using okhttp
  • findViewById (Activity)
  • getSharedPreferences (Context)
  • getResourceAsStream (ClassLoader)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now