Platform SDK Java 8.5 API Reference

com.genesyslab.platform.apptemplate.configuration.log
Class GAppLoggingOptions

java.lang.Object
  extended by com.genesyslab.platform.apptemplate.configuration.log.GAppLoggingOptions
All Implemented Interfaces:
java.lang.Cloneable

public class GAppLoggingOptions
extends java.lang.Object
implements java.lang.Cloneable

Parser of "log" section of CME Application objects' Options.

This class is automatically used by 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.
Simple application configuration usage:

 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
<T extends java.lang.Enum<T>>
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.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

LOG_SECTION_NAME

public static final java.lang.String LOG_SECTION_NAME
See Also:
Constant Field Values

LOG_EXT_SECTION_NAME

public static final java.lang.String LOG_EXT_SECTION_NAME
See Also:
Constant Field Values

TARGET_TYPE_STDOUT

public static final java.lang.String TARGET_TYPE_STDOUT
See Also:
Constant Field Values

TARGET_TYPE_STDERR

public static final java.lang.String TARGET_TYPE_STDERR
See Also:
Constant Field Values

TARGET_TYPE_NETWORK

public static final java.lang.String TARGET_TYPE_NETWORK
See Also:
Constant Field Values

TARGET_TYPE_MEMORY

public static final java.lang.String TARGET_TYPE_MEMORY
See Also:
Constant Field Values
Constructor Detail

GAppLoggingOptions

public GAppLoggingOptions(IGApplicationConfiguration appConfig,
                          ILogger logger)
Creates logging options parsing helper class instance by given application configuration.

Simple application configuration usage:

 CfgApplication theApp = confService.retrieveObject(
         CfgApplication.class, new CfgApplicationQuery(myAppName));
 GApplicationConfiguration appConfig = new GCOMApplicationConfiguration(theApp);

 GAppLoggingOptions logOpts = new GAppLoggingOptions(appConfig, null);
 

Parameters:
appConfig - the application configuration.
logger - optional "status" logger to print errors of options parsing methods.

GAppLoggingOptions

public GAppLoggingOptions(KeyValueCollection logOptions,
                          ILogger logger)
Creates logging options parsing helper class instance by given logging configuration options.

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");

 GAppLoggingOptions logOpts = new GAppLoggingOptions(logSection, null);
 

Parameters:
logOptions - the application configuration.
logger - optional "status" logger to print errors of options parsing methods.

GAppLoggingOptions

public GAppLoggingOptions(KeyValueCollection logOptions,
                          KeyValueCollection logExtOptions,
                          ILogger logger)
Creates logging options parsing helper class instance by given logging configuration options.

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);
 

Parameters:
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

clone

public GAppLoggingOptions clone()
Overrides:
clone in class java.lang.Object

getEnableThread

public java.lang.Boolean getEnableThread()
Returns the logging thread enabling option value.

See Also:
LogOptionsDescriptions.ENABLE_THREAD_OPT

getIncludeLocation

public java.lang.Boolean getIncludeLocation()
Returns the enable location option value to be used with Log4j2 asynchronous loggers.

See Also:
LogOptionsDescriptions.ENABLE_LOCATION_FOR_THREAD_OPT, getEnableThread()

getMessageFormat

public MessageFormat getMessageFormat()
Returns the message format option value.

See Also:
LogOptionsDescriptions.MESSAGE_FORMAT_OPT

getMessageHeaderDelimiter

public java.lang.String getMessageHeaderDelimiter()
Returns the message header delimiter option value.

See Also:
LogOptionsDescriptions.MESSAGE_HEADER_DELIMITER_OPT

getTimeFormatting

public TimeFormat getTimeFormatting()
Returns the time format configuration option.

Returns:
the time format configuration option.
See Also:
LogOptionsDescriptions.TIME_FORMAT_OPT

getTimeConverting

public TimeUsage getTimeConverting()
Returns the time convert configuration option.

Returns:
the time convert configuration option.
See Also:
LogOptionsDescriptions.TIME_CONVERT_OPT

getVerbose

public VerboseLevel getVerbose()
Returns the verbose configuration option.

Returns:
the verbose level configuration option.
See Also:
LogOptionsDescriptions.VERBOSE_OPT

getSegment

public SegmentationConfig getSegment()
Returns the log segmentation configuration option.

Returns:
the segmentation configuration.
See Also:
LogOptionsDescriptions.SEGMENT_OPT

getExpire

public ExpirationConfig getExpire()
Returns the log expiration configuration option.

Returns:
the expiration configuration.
See Also:
LogOptionsDescriptions.EXPIRE_OPT

getMessageFile

public java.lang.String getMessageFile()
Returns the messagefile option value.

See Also:
LogOptionsDescriptions.MESSAGEFILE_OPT

getFileEncoding

public java.lang.String getFileEncoding()
Returns the logfile encoding option value.

See Also:
LogOptionsDescriptions.LOGFILE_ENCODING_OPT

getFileHeaderProvider

public java.lang.String getFileHeaderProvider()
Returns the logfile header provider option value.

See Also:
LogOptionsDescriptions.FILE_HEADER_PROVIDER_OPT

getEventlogHost

public java.lang.String getEventlogHost()
Returns the logging application host name option value.

See Also:
LogOptionsDescriptions.EVENTLOG_HOST_OPT

getPrintAttributes

public java.lang.Boolean getPrintAttributes()
Returns the logs attributes printing enabling option value.

See Also:
LogOptionsDescriptions.PRINT_ATTRIBUTES_OPT

getLog4j2ConfigProfile

public java.lang.String getLog4j2ConfigProfile()
Returns the AppTemplate Log4j2 configuration profile option value.

See Also:
LogOptionsDescriptions.LOG4j2_CONFIG_PROFILE_OPT

getOutputDescriptors

public 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.

This list is being built by content of log levels named options: "all", "debug", "trace", "interaction", "standard", and "alarm".
For example, with logging configuration like following:

 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)
 ]
 

Returns:
collection of logging targets descriptions.

getLogExtendedOptions

public GAppLogExtOptions getLogExtendedOptions()
Returns configuration options defined by application "log-extended" Options section.

Returns:
options defined by the "log-extended" section or null.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getBooleanOptionValue

protected java.lang.Boolean getBooleanOptionValue(LogOptionsDescriptions.OptionDescriptor<java.lang.Boolean> optDescr)

getEnumOptionValue

protected <T extends java.lang.Enum<T>> T getEnumOptionValue(LogOptionsDescriptions.OptionDescriptor<T> optDescr)

getFirstOptionValue

protected java.lang.String getFirstOptionValue(LogOptionsDescriptions.OptionDescriptor<?> descriptor)

Platform SDK Java 8.5 API Reference

Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.