org.modeshape.common.logging
Class LogFactory
java.lang.Object
org.modeshape.common.logging.LogFactory
- Direct Known Subclasses:
- JdkLoggerFactory, Log4jLoggerFactory, SLF4JLoggerFactory
public abstract class LogFactory
- extends Object
The abstract class for the LogFactory, which is called to create a specific implementation of the Logger
.
ModeShape provides out of the box several LogFactory implementations that work with common log frameworks:
- SLF4J (which sits atop several logging frameworks)
- Log4J
- JDK Util Logging
The static initializer for this class checks the classpath for the availability of these frameworks, and as soon as one
is found the LogFactory implementation for that framework is instantiated and used for all ModeShape logging.
However, since ModeShape can be embedded into any application, it is possible that applications use a logging
framework other than those listed above. So before falling back to the JDK logging, ModeShape looks for the
org.modeshape.common.logging.CustomLoggerFactory
class, and if found attempts to instantiate and use it.
But ModeShape does not provide this class out of the box; rather an application that is embedding ModeShape can provide
its own version of that class that should extend LogFactory
and create an appropriate implementation of
Logger
that forwards ModeShape log messages to the application's logging framework.
Field Summary |
static String |
CUSTOM_LOG_FACTORY_CLASSNAME
The name of the LogFactory implementation that is not provided out of the box but can be created,
implemented, and placed on the classpath to have ModeShape send log messages to a custom framework. |
Method Summary |
protected abstract Logger |
getLogger(String name)
Return a logger named according to the name parameter. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CUSTOM_LOG_FACTORY_CLASSNAME
public static final String CUSTOM_LOG_FACTORY_CLASSNAME
- The name of the
LogFactory
implementation that is not provided out of the box but can be created,
implemented, and placed on the classpath to have ModeShape send log messages to a custom framework.
- See Also:
- Constant Field Values
LogFactory
public LogFactory()
getLogger
protected abstract Logger getLogger(String name)
- Return a logger named according to the name parameter.
- Parameters:
name
- The name of the logger.
- Returns:
- logger
Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.