|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.genesyslab.platform.apptemplate.lmslogger.LmsLoggerFactory
public abstract class LmsLoggerFactory
Abstract factory class for LMS event loggers.
It's the entry point of the LMS logging functionality.
LmsLoggerFactory.createInstance
(new LmsMessageConveyor());
LmsEventLogger lmsLogger = LmsLoggerFactory.getLmsLogger
(getClass());
If application has own LMS file declarations, it may use custom LmsEnum enumeration(s):
LmsLoggerFactory.createInstance
(
new LmsMessageConveyor(CommonLmsEnum.class, MyAppLmsEnum.class));
...
Note: If application uses the
Application Configuration Manager
, there is no need to configure LmsLofferFactory
-
it will be done by the manager. It only needs to have properly constructed
LmsMessageConveyor
Wrapping of LmsEventLogger
's and LmsLoggerFactory
allows
applications to make LMS logging redirection/reconfiguration in a runtime.
// Reconfigure LMS loggers to direct logs to Log4j2:
LmsLoggerFactory.setLoggerFactoryImpl
(Log.LOG_FACTORY_LOG4J2, lmsMessageConveyor);
Application Template AB contains several built-in implementations of LmsLoggerFactory
.Log4j2
, Slf4j
,
Log4j
, and java.util.logging
.stdout
, and to switch LMS logging off.
LmsMessageConveyor
Nested Class Summary | |
---|---|
static class |
LmsLoggerFactory.AbstractFactoryBuilder<F extends LmsLoggerFactory,B extends LmsLoggerFactory.AbstractFactoryBuilder<F,B>>
|
protected static class |
LmsLoggerFactory.WrappedLogger
The LmsEventLogger wrapper to be implicitly used by applications. It makes possible automatic reconfiguration of LMS events logging without recreation of applications' loggers instances. |
protected static class |
LmsLoggerFactory.WrappedLoggerFactory
The LmsLoggerFactory wrapper to provide application with wrapped LmsEventLogger's. |
Field Summary | |
---|---|
static java.lang.String |
LMS_LOGGER_FACTORY_CLASS_PROP
|
Constructor Summary | |
---|---|
protected |
LmsLoggerFactory(LmsMessageConveyor lmsc)
Protected constructor of the abstract class. |
Method Summary | |
---|---|
static LmsLoggerFactory |
createInstance(LmsMessageConveyor lmsConveyor)
Creates and initializes the application singleton instance of LmsLoggerFactory . |
abstract LmsEventLogger |
getLmsLogger(java.lang.Class<?> clazz)
Gets an LmsEventLogger instance by class. |
abstract LmsEventLogger |
getLmsLogger(java.lang.String name)
Gets an LmsEventLogger instance by name. |
static LmsEventLogger |
getLogger(java.lang.Class<?> clazz)
Gets an LmsEventLogger instance by class. It uses statically initialized and wrapped logger factory instance. So, this it may be used after initialization with createInstance(LmsMessageConveyor) .Its wrapping allows automatic reconfiguration of LmsEventLogger implementation without need to recreate LmsEventLogger's instances by user application. |
static LmsEventLogger |
getLogger(java.lang.String name)
Gets an LmsEventLogger instance by name. It uses statically initialized and wrapped logger factory instance. So, this it may be used after initialization with createInstance(LmsMessageConveyor) .Its wrapping allows automatic reconfiguration of LmsEventLogger implementation without need to recreate LmsEventLogger's instances by user application. |
static LmsLoggerFactory |
getLoggerFactory()
Returns reference to the static LmsLoggerFactory singleton instance. |
LmsMessageConveyor |
getMessageConveyor()
Returns reference to the LmsMessageConveyor instance of this logger factory. |
static LmsLoggerFactory |
setLoggerFactoryImpl(LmsLoggerFactory factory)
Sets LMS logging system implementation. |
static LmsLoggerFactory |
setLoggerFactoryImpl(java.lang.String factoryName,
LmsMessageConveyor lmsConveyor)
Sets LMS logging system implementation. It may initialize LMS logging to work with one of PSDK built-in implementations, or user defined one, by its fully qualified class name or alias name. Following alias names are supported: Log.LOG_FACTORY_CONSOLE ("console" ) - This implementation of LMS logging functionality
prints LMS events to stdout ;
Log.LOG_FACTORY_LOG4J2 ("log4j2" ) - This factory is to send LMS events to Log4j v2.x
logging framework;
Log.LOG_FACTORY_SLF4J ("slf4j" ) - This factory is to send LMS events to Slf4j API;
Log.LOG_FACTORY_LOG4J ("log4j" ) - This factory is to send LMS events to Log4j v1.x
logging framework;
Log.LOG_FACTORY_JUL ("jul" ) - This factory is to send LMS events to
java.util.logging facade;
Log.LOG_FACTORY_AUTO ("auto" ) - It tries to detect available logging framework
for LMS events logging in the following order: Log4j2 ,
Slf4j , Log4j ;
if none of these frameworks is available, java.util.logging
will be used;
Log.LOG_FACTORY_NONE ("none" ) - It is to do not log events from LMS events loggers.
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String LMS_LOGGER_FACTORY_CLASS_PROP
Constructor Detail |
---|
protected LmsLoggerFactory(LmsMessageConveyor lmsc)
lmsc
- the LMS events definitions conveyor.Method Detail |
---|
public static LmsLoggerFactory getLoggerFactory()
LmsLoggerFactory
singleton instance.
createInstance(LmsMessageConveyor)
,
setLoggerFactoryImpl(LmsLoggerFactory)
public static LmsLoggerFactory createInstance(LmsMessageConveyor lmsConveyor)
LmsLoggerFactory
.
This is the recommended way for initialization of LMS events logging functionality.LmsLoggerFactory
,
or alias name of built-in implementation, than the correspondent class constructor
with LmsMessageConveyor
parameter is used to initialize the static logger factory.PsdkCustomization.PsdkOption.PsdkLoggerFactory
(and its correspondent
system property).LmsLoggerFactory.setLoggerFactoryImpl(Log.LOG_FACTORY_LOG4J2, lmsMessageConveyor)
.
lmsConveyor
- the LMS events definitions conveyor or null for the default LmsMessageConveyor.
public static LmsEventLogger getLogger(java.lang.String name)
createInstance(LmsMessageConveyor)
.
name
- the logger name.
createInstance(LmsMessageConveyor)
public static LmsEventLogger getLogger(java.lang.Class<?> clazz)
createInstance(LmsMessageConveyor)
.
clazz
- class to get the logger for.
createInstance(LmsMessageConveyor)
public static LmsLoggerFactory setLoggerFactoryImpl(LmsLoggerFactory factory)
factory
- new factory that creates loggers.
public static LmsLoggerFactory setLoggerFactoryImpl(java.lang.String factoryName, LmsMessageConveyor lmsConveyor)
Log.LOG_FACTORY_CONSOLE
("console"
) - This implementation of LMS logging functionality
prints LMS events to stdout
;Log.LOG_FACTORY_LOG4J2
("log4j2"
) - This factory is to send LMS events to Log4j v2.x
logging framework;Log.LOG_FACTORY_SLF4J
("slf4j"
) - This factory is to send LMS events to Slf4j API;Log.LOG_FACTORY_LOG4J
("log4j"
) - This factory is to send LMS events to Log4j v1.x
logging framework;Log.LOG_FACTORY_JUL
("jul"
) - This factory is to send LMS events to
java.util.logging
facade;Log.LOG_FACTORY_AUTO
("auto"
) - It tries to detect available logging framework
for LMS events logging in the following order: Log4j2
,
Slf4j
, Log4j
;
if none of these frameworks is available, java.util.logging
will be used;Log.LOG_FACTORY_NONE
("none"
) - It is to do not log events from LMS events loggers.
factoryName
- name of standard PSDK logger factory or class name of custom user implementation of it.lmsConveyor
- reference to new LmsMessageConveyor or null to reuse one from the current factory instance.
java.lang.IllegalArgumentException
- in case of wrong value of the given factory name.public LmsMessageConveyor getMessageConveyor()
public abstract LmsEventLogger getLmsLogger(java.lang.String name)
name
- the logger name.
public abstract LmsEventLogger getLmsLogger(java.lang.Class<?> clazz)
clazz
- class to get the logger for.
|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |