public class SormulaLoggerFactory
extends java.lang.Object
Use setLoggerClass(Class)
to change the default logger to one of the implementations
of SormulaLogger
in org.sormula.log package or any implementation of
SormulaLogger
.
The default logger class is Slf4jSormulaLogger
for backward compatibility since previous
versions of Sormula used ClassLogger
which is dependent upon SLF4J. The default logger does
not require any SLF4J jars to be on classpath at runtime if no logging is desired.
Constructor and Description |
---|
SormulaLoggerFactory() |
Modifier and Type | Method and Description |
---|---|
static SormulaLogger |
getClassLogger()
Gets a logger with logical log name as package name of the caller
of this method.
|
static java.lang.Class<? extends SormulaLogger> |
getLoggerClass()
Gets the logger class to use in
getClassLogger() . |
static void |
setLoggerClass(java.lang.Class<? extends SormulaLogger> loggerClass)
Sets the logger class to be used by Sormula.
|
static void |
setLoggerClass(java.lang.String loggerClassName)
Loads class with name provided in loggerClassName and invokes
setLoggerClass(Class) . |
public static SormulaLogger getClassLogger()
getClassLogger()
then a SormulaLogger with
the logical log name of org.sormula.something would be returned.public static java.lang.Class<? extends SormulaLogger> getLoggerClass()
getClassLogger()
. The default
is Slf4jSormulaLogger
for backward compatibility since the original
logger used by Sormula was ClassLogger
which is dependent upon SLF4J.getClassLogger()
public static void setLoggerClass(java.lang.String loggerClassName) throws LogException
setLoggerClass(Class)
.loggerClassName
- the fully qualified name of the class that implements SormulaLogger
LogException
- if error, see exception message for reasonpublic static void setLoggerClass(java.lang.Class<? extends SormulaLogger> loggerClass) throws LogException
Setting the logger class determines the logger for Sormula classes that are not already
loaded by the class loader. Sormula classes have static reference to SormulaLogger
objects that are initialized when the Sormula class was loaded into memory. Typically
setLoggerClass(Class)
should be used prior to using any Sormula classes.
loggerClass
- any class that implements SormulaLogger
interfaceLogException
- if error, see exception message for reason