java.lang.Cloneable
public class GAppLoggingOptions
extends java.lang.Object
implements java.lang.Cloneable
Application Configuration Manager
and
Log4j2 Configurator
.
For a case, when application does not use the configuration manager, does need some custom logging configuration,
or for some testing purposes, it is possible to use this class to create logging configuration.
CfgApplication theApp = confService.retrieveObject(
CfgApplication.class, new CfgApplicationQuery(myAppName));
GApplicationConfiguration appConfig = new GCOMApplicationConfiguration(theApp);
GAppLoggingOptions logOpts = new GAppLoggingOptions(appConfig, null);
Or simple initialization without application configuration reading (without ConfService usage):
KeyValueCollection logSection = new KeyValueCollection();
logSection.addString("verbose", "all");
logSection.addString("message-format", "full");
logSection.addString("standard", "Log4j2ConfiguratorTest-std");
logSection.addString("all", "stdout, Log4j2ConfiguratorTest-all");
KeyValueCollection logExtSection = new KeyValueCollection();
logExtSection.addString("level-reassign-14005", "ALARM");
logExtSection.addString("level-reassign-14006", "ALARM");
logExtSection.addString("logger-psdk", "com.genesyslab.platform: level=debug");
logExtSection.addString("logger-apache", "org.apache: level=error");
GAppLoggingOptions logOpts = new GAppLoggingOptions(logSection, logExtSection, null);
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
LOG_EXT_SECTION_NAME |
|
static java.lang.String |
LOG_SECTION_NAME |
|
static java.lang.String |
TARGET_TYPE_MEMORY |
|
static java.lang.String |
TARGET_TYPE_NETWORK |
|
static java.lang.String |
TARGET_TYPE_STDERR |
|
static java.lang.String |
TARGET_TYPE_STDOUT |
Constructor | Description |
---|---|
GAppLoggingOptions(IGApplicationConfiguration appConfig,
ILogger logger) |
Creates logging options parsing helper class instance by given application configuration.
|
GAppLoggingOptions(KeyValueCollection logOptions,
KeyValueCollection logExtOptions,
ILogger logger) |
Creates logging options parsing helper class instance by given logging configuration options.
|
GAppLoggingOptions(KeyValueCollection logOptions,
ILogger logger) |
Creates logging options parsing helper class instance by given logging configuration options.
|
Modifier and Type | Method | Description |
---|---|---|
GAppLoggingOptions |
clone() |
|
boolean |
equals(java.lang.Object obj) |
|
protected java.lang.Boolean |
getBooleanOptionValue(LogOptionsDescriptions.OptionDescriptor<java.lang.Boolean> optDescr) |
|
java.lang.String |
getCompressMethod() |
Specifies method that will be used for archiving log files.
|
java.lang.String |
getCustomMessageFormat() |
Returns the custom message format option value.
|
java.lang.String |
getDefaultLogdir() |
Returns the AppTemplate default log directory option value.
|
java.lang.Boolean |
getEnableThread() |
Returns the logging thread enabling option value.
|
protected <T extends java.lang.Enum<T>> |
getEnumOptionValue(LogOptionsDescriptions.OptionDescriptor<T> optDescr) |
|
java.lang.String |
getEventlogHost() |
Returns the logging application host name option value.
|
ExpirationConfig |
getExpire() |
Returns the log expiration configuration option.
|
java.lang.String |
getFileEncoding() |
Returns the logfile encoding option value.
|
java.lang.String |
getFileHeaderProvider() |
Returns the logfile header provider option value.
|
protected java.lang.String |
getFirstOptionValue(LogOptionsDescriptions.OptionDescriptor<?> descriptor) |
|
java.lang.Boolean |
getIncludeLocation() |
Returns the enable location option value to be used with Log4j2 asynchronous loggers.
|
java.lang.String |
getLog4j2ConfigProfile() |
Returns the AppTemplate Log4j2 configuration profile option value.
|
GAppLogExtOptions |
getLogExtendedOptions() |
Returns configuration options defined by application "log-extended" Options section.
|
java.lang.String |
getMessageFile() |
Returns the messagefile option value.
|
MessageFormat |
getMessageFormat() |
Returns the message format option value.
|
java.lang.String |
getMessageHeaderDelimiter() |
Returns the message header delimiter option value.
|
java.lang.String |
getMsgsrvIntmsgsLevel() |
Returns log messages level filter on Message Server Appender for Platform SDK internal events.
|
java.util.List<TargetDescriptor> |
getOutputDescriptors() |
Returns normalized list of logging output targets declarations with correspondent log levels
including network, stdout, stderr, and log files with their names.
|
java.lang.String |
getOutputPattern() |
Returns the custom message format option value.
|
java.lang.Boolean |
getPrintAttributes() |
Returns the logs attributes printing enabling option value.
|
SegmentationConfig |
getSegment() |
Returns the log segmentation configuration option.
|
TimeUsage |
getTimeConverting() |
Returns the time convert configuration option.
|
TimeFormat |
getTimeFormatting() |
Returns the time format configuration option.
|
java.lang.Boolean |
getUseNativeLevels() |
Returns flag value for enabling of native log levels usage in standard LMS loggers formatter.
|
VerboseLevel |
getVerbose() |
Returns the verbose configuration option.
|
int |
hashCode() |
|
java.lang.String |
toString() |
public static final java.lang.String LOG_SECTION_NAME
public static final java.lang.String LOG_EXT_SECTION_NAME
public static final java.lang.String TARGET_TYPE_STDOUT
public static final java.lang.String TARGET_TYPE_STDERR
public static final java.lang.String TARGET_TYPE_NETWORK
public static final java.lang.String TARGET_TYPE_MEMORY
public GAppLoggingOptions(IGApplicationConfiguration appConfig, ILogger logger)
CfgApplication theApp = confService.retrieveObject(
CfgApplication.class, new CfgApplicationQuery(myAppName));
GApplicationConfiguration appConfig = new GCOMApplicationConfiguration(theApp);
GAppLoggingOptions logOpts = new GAppLoggingOptions(appConfig, null);
appConfig
- the application configuration.logger
- optional "status" logger to print errors of options parsing methods.public GAppLoggingOptions(KeyValueCollection logOptions, ILogger logger)
KeyValueCollection logSection = new KeyValueCollection();
logSection.addString("verbose", "all");
logSection.addString("message-format", "full");
logSection.addString("standard", "Log4j2ConfiguratorTest-std");
logSection.addString("all", "stdout, Log4j2ConfiguratorTest-all");
GAppLoggingOptions logOpts = new GAppLoggingOptions(logSection, null);
logOptions
- the application configuration.logger
- optional "status" logger to print errors of options parsing methods.public GAppLoggingOptions(KeyValueCollection logOptions, KeyValueCollection logExtOptions, ILogger logger)
KeyValueCollection logSection = new KeyValueCollection();
logSection.addString("verbose", "all");
logSection.addString("message-format", "full");
logSection.addString("standard", "Log4j2ConfiguratorTest-std");
logSection.addString("all", "stdout, Log4j2ConfiguratorTest-all");
KeyValueCollection logExtSection = new KeyValueCollection();
logExtSection.addString("level-reassign-14005", "ALARM");
logExtSection.addString("level-reassign-14006", "ALARM");
logExtSection.addString("logger-psdk", "com.genesyslab.platform: level=debug");
logExtSection.addString("logger-apache", "org.apache: level=error");
GAppLoggingOptions logOpts = new GAppLoggingOptions(logSection, logExtSection, null);
logOptions
- the application log Options section.logExtOptions
- the application log-extended Options section.logger
- optional "status" logger to print errors of options parsing methods.public GAppLoggingOptions clone()
clone
in class java.lang.Object
public java.lang.Boolean getEnableThread()
LogOptionsDescriptions.ENABLE_THREAD_OPT
public java.lang.Boolean getIncludeLocation()
public MessageFormat getMessageFormat()
public java.lang.String getMessageHeaderDelimiter()
public java.lang.String getCustomMessageFormat()
LogOptionsDescriptions.CUSTOM_MESSAGE_FORMAT_OPT
public java.lang.String getOutputPattern()
LogOptionsDescriptions.OUTPUT_PATTERN_OPT
public java.lang.Boolean getUseNativeLevels()
LogOptionsDescriptions.USE_NATIVE_LEVELS_OPT
public TimeFormat getTimeFormatting()
LogOptionsDescriptions.TIME_FORMAT_OPT
public TimeUsage getTimeConverting()
LogOptionsDescriptions.TIME_CONVERT_OPT
public VerboseLevel getVerbose()
LogOptionsDescriptions.VERBOSE_OPT
public SegmentationConfig getSegment()
LogOptionsDescriptions.SEGMENT_OPT
public ExpirationConfig getExpire()
LogOptionsDescriptions.EXPIRE_OPT
public java.lang.String getCompressMethod()
LogOptionsDescriptions.COMPRESS_METHOD_OPT
public java.lang.String getMessageFile()
LogOptionsDescriptions.MESSAGEFILE_OPT
public java.lang.String getFileEncoding()
public java.lang.String getFileHeaderProvider()
public java.lang.String getEventlogHost()
LogOptionsDescriptions.EVENTLOG_HOST_OPT
public java.lang.Boolean getPrintAttributes()
public java.lang.String getLog4j2ConfigProfile()
public java.lang.String getDefaultLogdir()
LogOptionsDescriptions.DEFAULT_LOGDIR_OPT
public java.lang.String getMsgsrvIntmsgsLevel()
LogOptionsDescriptions.X_MSGSRV_INTMSGS_LEVEL
public java.util.List<TargetDescriptor> getOutputDescriptors()
all
",
"debug
", "trace
", "interaction
", "standard
",
and "alarm
".
KeyValueCollection log = new KeyValueCollection();
log.addString("verbose", "interaction");
log.addString("interaction", "app-int.log");
log.addString("standard", "stdout, network, app-std.log");
GAppLoggingOptions logOpts = new GAppLoggingOptions(log, null);
List<TargetDescriptor> loggingTargets = logOpts.getOutputDescriptors();
we'll have the next logging targets ("appenders" in terms of a logging framework):
loggingTargets = [
LoggingTarget(type=STDOUT,level=STANDARD),
LoggingTarget(type=MESSAGESERVER,level=STANDARD),
LoggingTarget(type=FILELOGGER,level=STANDARD,filename=app-std.log),
LoggingTarget(type=FILELOGGER,level=INTERACTION,filename=app-int.log)
]
public GAppLogExtOptions getLogExtendedOptions()
null
.public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
protected java.lang.Boolean getBooleanOptionValue(LogOptionsDescriptions.OptionDescriptor<java.lang.Boolean> optDescr)
protected <T extends java.lang.Enum<T>> T getEnumOptionValue(LogOptionsDescriptions.OptionDescriptor<T> optDescr)
protected java.lang.String getFirstOptionValue(LogOptionsDescriptions.OptionDescriptor<?> descriptor)
Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 9.0.006.00
Copyright © 2006–2019 Genesys Telecommunications Laboratories, Inc. All rights reserved.