|
Platform SDK Java 8.5 API Reference | |||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Class Summary | |
---|---|
GFAppLog4j2Updater | Application logging configuration applier/updater for Log4j2. |
GFileHeaderProvider | Extension of the default file header provider with information about available PSDK components' versions. |
Log4j2Configurator | This class contains configuration appliance logic for Log4j2 logging framework. |
PsdkLog4j2Configuration | Log4j2 logging configuration structure implementation with initialization from Genesys CME Application logging settings. |
This package contains a set of AppTemplate classes related to Log4j v2 support.
Its main facade classes for direct configuration by user applications areLog4j2Configurator
and
PsdkLog4j2Configuration
.GFAppLog4j2Updater
,
which may be used with the application configuration manager
GFApplicationConfigurationManager
.
If application configuration is managed with one of the mentioned configuration managers,
to keep application logging configuration up to date, it is enough to register there an instance of
GFAppLog4j2Updater
.
It listens for the application configuration updates, and if its logging options got changed,
it uses Log4j2Configurator
to reconfigure Log4j2.
For a case, when application does not use the configuration manager, or for some testing purposes,
it is possible to configure Log4j2 explicitly.
CfgApplication theApp = confService.retrieveObject(
CfgApplication.class, new CfgApplicationQuery(myAppName));
GApplicationConfiguration appConfig = new GCOMApplicationConfiguration(theApp);
LmsMessageConveyor lmsMessages = new LmsMessageConveyor(CommonLmsEnum.class, MyAppLmsEnum.class);
lmsMessages.loadConfiguration(appConfig);
Log4j2Configurator.applyLoggingConfig(appConfig, lmsMessages);
Or simple Log4j2 configuration without application configuration reading (without ConfService usage):
GApplicationConfiguration appConfig = new GApplicationConfiguration();
appConf.setApplicationName(myAppName);
KeyValueCollection options = new KeyValueCollection();
KeyValueCollection logSection = new KeyValueCollection();
logSection.addString("verbose", "all");
logSection.addString("message-format", "full");
logSection.addString("standard", "Log4j2ConfiguratorTest-std");
logSection.addString("all", "stdout, Log4j2ConfiguratorTest-all");
options.addList("log", logSection);
appConf.setOptions(options);
Log4j2Configurator.applyLoggingConfig(appConfig, null);
Or, if no LMS files or network logging target is supposed, it is possible to configure logging
without creation of the application configuration structure:
KeyValueCollection logOpts = new KeyValueCollection();
logOpts.addString("verbose", "all");
logOpts.addString("message-format", "full");
logOpts.addString("standard", "Log4j2ConfiguratorTest-std");
logOpts.addString("all", "stdout, Log4j2ConfiguratorTest-all");
Log4j2Configurator.setConfig(PsdkLog4j2Configuration.parse(logOpts));
|
Platform SDK Java 8.5 API Reference | |||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |