org.beanfabrics.log
Class LoggerFactory

java.lang.Object
  extended by org.beanfabrics.log.LoggerFactory

public class LoggerFactory
extends java.lang.Object

Beanfabrics classes use this LoggerFactory for producing a Logger instance.

Slf4jLogger is produced as default if the SLF4J api is included in the classpath. Otherwise a Jdk14Logger is produced.

You can configure this factory to produceFa custom Logger by

Beanfabrics uses this 'own' LoggerFactory and Logger to be runtime independent of any foreign library.

Author:
Michael Karneim, Max Gensthaler
See Also:
Logging Example

Field Summary
static java.lang.String SYSPROPKEY_LOGGER
          The key of the system property to set a custom Logger.
 
Constructor Summary
LoggerFactory()
           
 
Method Summary
static Logger getLogger(java.lang.Class clazz)
          Returns a the Logger instance for a certain Class.
static void setLoggerClass(java.lang.Class clazz)
          Set the Class implementing the Logger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SYSPROPKEY_LOGGER

public static final java.lang.String SYSPROPKEY_LOGGER
The key of the system property to set a custom Logger.

Constructor Detail

LoggerFactory

public LoggerFactory()
Method Detail

getLogger

public static Logger getLogger(java.lang.Class clazz)
Returns a the Logger instance for a certain Class.

Parameters:
clazz - the Class the Logger is for
Returns:
the Logger instance

setLoggerClass

public static void setLoggerClass(java.lang.Class clazz)
                           throws java.lang.IllegalArgumentException
Set the Class implementing the Logger. This class will be used to create new instances by getLogger(Class).

Parameters:
clazz - the Class implementing the Logger
Throws:
java.lang.IllegalArgumentException - if clazz is null, does not implement Logger or has no constructor with the argument "Class clazz"


© 2010 by Michael Karneim, http://www.beanfabrics.org