public abstract class VitamLoggerFactory extends Object
VitamLogger
or changes the default factory implementation. This factory allows you to choose what
logging framework VITAM should use. The default factory is LogbackLoggerFactory
. If SLF4J is not available,
Log4JLoggerFactory is used. If Log4J is not available, JdkLoggerFactory
is used. You can change it to
your preferred logging framework before other VITAM classes are loaded:
VitamLoggerFactory
.setDefaultFactory(new Log4JLoggerFactory());
Please note that the new default factory is effective only for the classes which were loaded after the default
factory is changed. Therefore, setDefaultFactory(VitamLoggerFactory)
should be called as early as possible
and shouldn't be called more than once.Modifier and Type | Field and Description |
---|---|
protected static VitamLogLevel |
currentLevel |
Constructor and Description |
---|
VitamLoggerFactory(VitamLogLevel level) |
Modifier and Type | Method and Description |
---|---|
static VitamLoggerFactory |
getDefaultFactory()
Returns the default factory.
|
static VitamLogger |
getInstance(Class<?> clazz)
Creates a new logger instance with the name of the specified class.
|
static VitamLogger |
getInstance(String name)
Creates a new logger instance with the specified name.
|
protected abstract VitamLogLevel |
getLevelSpecific() |
static VitamLogLevel |
getLogLevel() |
protected abstract VitamLogger |
newInstance(String name)
Creates a new logger instance with the specified name.
|
protected abstract void |
seLevelSpecific(VitamLogLevel level)
Set the level for the specific implementation
|
static void |
setDefaultFactory(VitamLoggerFactory defaultFactory)
Changes the default factory.
|
protected static void |
setInternalLogLevel(VitamLogLevel level) |
static void |
setLogLevel(VitamLogLevel level) |
protected static VitamLogLevel currentLevel
public VitamLoggerFactory(VitamLogLevel level)
level
- the vitam log levelpublic static VitamLoggerFactory getDefaultFactory()
JdkLoggerFactory
.public static void setDefaultFactory(VitamLoggerFactory defaultFactory)
defaultFactory
- instance of VitamLoggerFactorypublic static VitamLogger getInstance(Class<?> clazz)
clazz
- specified classpublic static VitamLogger getInstance(String name)
name
- to create new logger instancepublic static VitamLogLevel getLogLevel()
public static void setLogLevel(VitamLogLevel level)
level
- the vitam log levelprotected static void setInternalLogLevel(VitamLogLevel level)
protected abstract VitamLogLevel getLevelSpecific()
protected abstract void seLevelSpecific(VitamLogLevel level)
level
- protected abstract VitamLogger newInstance(String name)
Copyright © 2019 Vitam. All rights reserved.