public abstract class WaarpLoggerFactory extends Object
WaarpLogger
or changes the default factory
implementation.
This factory allows you to
choose what logging framework Waarp should use. The default factory is
WaarpSlf4JLoggerFactory
. If
SLF4J is not available, WaarpSlf4JLoggerFactory
is used. If Log4J is
not available,
WaarpJdkLoggerFactory
is used. You can change it to your preferred
logging framework before other
Waarp classes are loaded:
WaarpLoggerFactory
.setDefaultFactory(newWaarpSlf4JLoggerFactory
());
Please note that the new default factory is effective only for the classes
which were loaded after the
default factory is changed. Therefore, setDefaultFactory(WaarpLoggerFactory)
should be called as
early as possible and shouldn't be called more than once.
Modifier and Type | Field and Description |
---|---|
protected static WaarpLogLevel |
currentLevel |
Modifier | Constructor and Description |
---|---|
protected |
WaarpLoggerFactory(WaarpLogLevel level) |
Modifier and Type | Method and Description |
---|---|
static WaarpLoggerFactory |
getDefaultFactory()
Returns the default factory.
|
static WaarpLogger |
getInstance(Class<?> clazz)
Creates a new logger instance with the name of the specified class.
|
static WaarpLogger |
getInstance(String name)
Creates a new logger instance with the specified name.
|
protected abstract WaarpLogLevel |
getLevelSpecific() |
static WaarpLogger |
getLogger(Class<?> clazz)
Creates a new logger instance with the name of the specified class.
|
static WaarpLogger |
getLogger(String name)
Creates a new logger instance with the specified name.
|
static WaarpLogLevel |
getLogLevel() |
protected abstract WaarpLogger |
newInstance(String name)
Creates a new logger instance with the specified name.
|
protected abstract void |
seLevelSpecific(WaarpLogLevel level)
Set the level for the specific implementation
|
static void |
setDefaultFactory(WaarpLoggerFactory defaultFactory)
Changes the default factory.
|
protected static void |
setInternalLogLevel(WaarpLogLevel level) |
static void |
setLocalName(String localNameNew) |
static void |
setLogLevel(WaarpLogLevel level) |
protected static WaarpLogLevel currentLevel
protected WaarpLoggerFactory(WaarpLogLevel level)
level
- public static WaarpLoggerFactory getDefaultFactory()
WaarpJdkLoggerFactory
.public static void setDefaultFactory(WaarpLoggerFactory defaultFactory)
defaultFactory
- public static WaarpLogger getInstance(Class<?> clazz)
clazz
- public static WaarpLogger getInstance(String name)
name
- public static WaarpLogger getLogger(Class<?> clazz)
clazz
- public static WaarpLogger getLogger(String name)
name
- public static void setLogLevel(WaarpLogLevel level)
level
- public static WaarpLogLevel getLogLevel()
protected static void setInternalLogLevel(WaarpLogLevel level)
public static void setLocalName(String localNameNew)
localNameNew
- if set, will be added to each line of logprotected abstract WaarpLogLevel getLevelSpecific()
protected abstract void seLevelSpecific(WaarpLogLevel level)
level
- protected abstract WaarpLogger newInstance(String name)
Copyright © 2009–2020 Waarp. All rights reserved.