|
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.configuration.log.GAppLoggingOptions
public class GAppLoggingOptions
Parser of "log" section of CME Application objects' Options.
This class is automatically used byApplication 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);
Field Summary | |
---|---|
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 Summary | |
---|---|
GAppLoggingOptions(IGApplicationConfiguration appConfig,
ILogger logger)
Creates logging options parsing helper class instance by given application configuration. |
|
GAppLoggingOptions(KeyValueCollection logOptions,
ILogger logger)
Creates logging options parsing helper class instance by given logging configuration options. |
|
GAppLoggingOptions(KeyValueCollection logOptions,
KeyValueCollection logExtOptions,
ILogger logger)
Creates logging options parsing helper class instance by given logging configuration options. |
Method Summary | ||
---|---|---|
GAppLoggingOptions |
clone()
|
|
boolean |
equals(java.lang.Object obj)
|
|
protected java.lang.Boolean |
getBooleanOptionValue(LogOptionsDescriptions.OptionDescriptor<java.lang.Boolean> optDescr)
|
|
java.lang.Boolean |
getEnableThread()
Returns the logging thread enabling option value. |
|
protected
|
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.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.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. |
|
VerboseLevel |
getVerbose()
Returns the verbose configuration option. |
|
int |
hashCode()
|
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
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.Method Detail |
---|
public GAppLoggingOptions clone()
clone
in class java.lang.Object
public java.lang.Boolean getEnableThread()
LogOptionsDescriptions.ENABLE_THREAD_OPT
public java.lang.Boolean getIncludeLocation()
LogOptionsDescriptions.ENABLE_LOCATION_FOR_THREAD_OPT
,
getEnableThread()
public MessageFormat getMessageFormat()
LogOptionsDescriptions.MESSAGE_FORMAT_OPT
public java.lang.String getMessageHeaderDelimiter()
LogOptionsDescriptions.MESSAGE_HEADER_DELIMITER_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 getMessageFile()
LogOptionsDescriptions.MESSAGEFILE_OPT
public java.lang.String getFileEncoding()
LogOptionsDescriptions.LOGFILE_ENCODING_OPT
public java.lang.String getFileHeaderProvider()
LogOptionsDescriptions.FILE_HEADER_PROVIDER_OPT
public java.lang.String getEventlogHost()
LogOptionsDescriptions.EVENTLOG_HOST_OPT
public java.lang.Boolean getPrintAttributes()
LogOptionsDescriptions.PRINT_ATTRIBUTES_OPT
public java.lang.String getLog4j2ConfigProfile()
LogOptionsDescriptions.LOG4j2_CONFIG_PROFILE_OPT
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)
|
Platform SDK Java 8.5 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |