public abstract class LogFactory
extends java.lang.Object
This facility, and the related Log, are designed to insulate Partner
code from the specific logging API used. See Log for a more complete
description.
The interface for this class was largely copied from the class of the same name in the jakarta commons logging project. However it does not internally depend upon reflection, custom class loaders, or any other advanced JVM tricks not available on limited platforms like J2ME. It is much simpler - it assumes the application initialization code has set a default factory.
This class is designed to be extended. Subclasses adapt the generic interface
to a specific logging implementation, handing out instances of Log.
Copyright 2006 Partner Software, Inc.
| Modifier | Constructor and Description |
|---|---|
protected |
LogFactory()
Protected constructor that is not available for public use.
|
| Modifier and Type | Method and Description |
|---|---|
static LogFactory |
getFactory()
Gets the default LogFactory implementation.
|
Log |
instanceFor(java.lang.Class clazz)
Return a Log object for the given class.
|
abstract Log |
instanceFor(java.lang.String name)
Returns the correct Log instance for the given name.
|
static Log |
logFor(java.lang.Class clazz)
Convenience method to return a named logger, without the application
having to care about factories.
|
static Log |
logFor(java.lang.String name)
Convenience method to return a named logger, without the application
having to care about factories.
|
static void |
setFactory(LogFactory newDefault)
Sets the default LogFactory implementation.
|
protected LogFactory()
public static LogFactory getFactory()
public static void setFactory(LogFactory newDefault)
public static Log logFor(java.lang.Class clazz)
clazz - Class from which a log name will be derivedorg.apache.commons.logging.LogConfigurationException - if a suitable Log instance cannot be
returnedpublic static Log logFor(java.lang.String name)
name - Logical name of the Log instance to be returned
(the meaning of this name is only known to the underlying
logging implementation that is being wrapped)org.apache.commons.logging.LogConfigurationException - if a suitable Log instance cannot be
returnedpublic Log instanceFor(java.lang.Class clazz)
public abstract Log instanceFor(java.lang.String name)