org.apache.commons.logging.impl

Class Log4jFactory

public final class Log4jFactory extends LogFactory

Deprecated: Per discussion on COMMONS-DEV, the behind-the-scenes use of this class as a proxy factory has been removed. For 1.0, you can still request it directly if you wish, but it doesn't really do anything useful, and will be removed in 1.1.

Concrete subclass of LogFactory specific to log4j.

Author: Costin Manolache

Field Summary
Hashtableattributes
The configuration attributes for this LogFactory.
Hashtableinstances
Constructor Summary
Log4jFactory()
Method Summary
ObjectgetAttribute(String name)
Return the configuration attribute with the specified name (if any), or null if there is no such attribute.
String[]getAttributeNames()
Return an array containing the names of all currently defined configuration attributes.
LoggetInstance(Class clazz)
Convenience method to derive a name from the specified class and call getInstance(String) with it.
LoggetInstance(String name)
voidrelease()
Release any internal references to previously created Log instances returned by this factory.
voidremoveAttribute(String name)
Remove any configuration attribute associated with the specified name.
voidsetAttribute(String name, Object value)
Set the configuration attribute with the specified name.

Field Detail

attributes

private Hashtable attributes
The configuration attributes for this LogFactory.

instances

private Hashtable instances

Constructor Detail

Log4jFactory

public Log4jFactory()

Method Detail

getAttribute

public Object getAttribute(String name)
Return the configuration attribute with the specified name (if any), or null if there is no such attribute.

Parameters: name Name of the attribute to return

getAttributeNames

public String[] getAttributeNames()
Return 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 Log getInstance(Class clazz)
Convenience method to derive a name from the specified class and call getInstance(String) with it.

Parameters: clazz Class for which a suitable Log name will be derived

Throws: LogConfigurationException if a suitable Log instance cannot be returned

getInstance

public Log getInstance(String name)

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(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(String name, 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 2002-2004 The Apache Software Foundation.