net.sf.mmapps.commons.logging.impl
Class MMBaseLoggingFactory

java.lang.Object
  extended byorg.apache.commons.logging.LogFactory
      extended bynet.sf.mmapps.commons.logging.impl.MMBaseLoggingFactory

public class MMBaseLoggingFactory
extends org.apache.commons.logging.LogFactory

LogFactory for jakarta commons-logging who when used creates MMBase logging backed Log implementations.

Goal: To provide a single log configuration for applications that use both commons-logging and mmbase logging.
Achievement: By providing a commons-logging factory that uses mmbase-logging.

MMBaseLoggingFactory is a LogFactory for the jakarta commons-logging logging api. MMBaseLoggingFactory uses the MMBase logging mechanism found in org.mmbase.util.logging.Logging to provide the actual logging.

Version:
$Id: MMBaseLoggingFactory.java,v 1.1 2004/11/21 12:53:19 keesj Exp $
Author:
Kees Jongenburger

Field Summary
 
Fields inherited from class org.apache.commons.logging.LogFactory
factories, FACTORY_DEFAULT, FACTORY_PROPERTIES, FACTORY_PROPERTY, SERVICE_ID
 
Constructor Summary
MMBaseLoggingFactory()
           
 
Method Summary
 java.lang.Object getAttribute(java.lang.String name)
           
 java.lang.String[] getAttributeNames()
           
 org.apache.commons.logging.Log getInstance(java.lang.Class clazz)
          This method first first looks in it's internal cache if there is a existing Log for the given class.
 org.apache.commons.logging.Log getInstance(java.lang.String category)
          This method first first looks in it's internal cache if there is a existing Log with the given name.
 void release()
          Release any internal references to previously created Log instances returned by this factory.
 void removeAttribute(java.lang.String name)
          Remove any configuration attribute associated with the specified name.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Set the configuration attribute with the specified name.
 
Methods inherited from class org.apache.commons.logging.LogFactory
getContextClassLoader, getFactory, getLog, getLog, newFactory, release, releaseAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MMBaseLoggingFactory

public MMBaseLoggingFactory()
Method Detail

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Parameters:
name - Name of the attribute to return
Returns:
the configuration attribute with the specified name (if any), or null if there is no such attribute.

getAttributeNames

public java.lang.String[] getAttributeNames()
Returns:
an array containing the names of all currently defined configuration attributes. If there are no such attributes, a zero length array is returned.

getInstance

public org.apache.commons.logging.Log getInstance(java.lang.Class clazz)
                                           throws org.apache.commons.logging.LogConfigurationException
This method first first looks in it's internal cache if there is a existing Log for the given class. If that is not the case the method uses org.mmbase.Version to determine the version of mmbase used and depending on the version create a MMBase17Logger or a MMBase18Logger;

Parameters:
clazz - the class for witch to create a logger
Returns:
a mmbase backed Log implementationfor the given class
Throws:
org.apache.commons.logging.LogConfigurationException

getInstance

public org.apache.commons.logging.Log getInstance(java.lang.String category)
                                           throws org.apache.commons.logging.LogConfigurationException
This method first first looks in it's internal cache if there is a existing Log with the given name. If that is not the case the method uses org.mmbase.Version to determine the version of mmbase used and depending on the version create a MMBase17Logger or a MMBase18Logger;

Returns:
a mmbase backed Log implementation for the given log
Throws:
org.apache.commons.logging.LogConfigurationException

release

public void release()
Release any internal references to previously created Log instances returned by this factory. 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.


removeAttribute

public void removeAttribute(java.lang.String name)
Remove any configuration attribute associated with the specified name. If there is no such attribute, no action is taken.

Parameters:
name - Name of the attribute to remove

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Set the configuration attribute with the specified name. Calling this with a null value is equivalent to calling removeAttribute(name).

Parameters:
name - Name of the attribute to set
value - Value of the attribute to set, or null to remove any setting for this attribute


Copyright © 2003-2004 mmapps. All Rights Reserved.