Platform SDK Java 8.5 API Reference

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

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

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

Parser of "log-extended" 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);

 GAppLogExtOptions logExtOpts = logOpts.getLogExtendedOptions();
 
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, additivity=false, includeLocation=false");

 GAppLoggingOptions logOpts = new GAppLoggingOptions(logSection, logExtSection, null);

 GAppLogExtOptions logExtOpts = logOpts.getLogExtendedOptions();
 


Field Summary
static java.lang.String LEVEL_REASSIGN_DISABLE_EXT_OPT
           
static java.lang.String LEVEL_REASSIGN_OPT_PREFIX
           
static java.lang.String LOG_EXT_LOGGER_PREFIX
           
 
Constructor Summary
GAppLogExtOptions(KeyValueCollection logExtOptions, ILogger logger)
          Parsing constructor of "log-extended" section of application Options.
 
Method Summary
 GAppLogExtOptions clone()
           
 java.util.Map<java.lang.String,CustomLoggerExtConfig> getCustomLoggers()
          Returns loggers customization options.
It represents extended logging options like following:
 java.util.Map<java.lang.Integer,LmsLogLevel> getLevelReassigns()
          Returns LMS events levels reassignment configuration.
It represents extended logging options like following:
protected  java.util.Map<java.lang.String,CustomLoggerExtConfig> parseCustomLoggers(KeyValueCollection optsLogExt)
          Parsing method for custom loggers declarations.
protected  java.util.Map<java.lang.Integer,LmsLogLevel> parseLevelReassignments(KeyValueCollection optsLogExt)
          Extracts map of LMS events level reassignment configuration from "log-extended" section of the application configuration object.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEVEL_REASSIGN_OPT_PREFIX

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

LEVEL_REASSIGN_DISABLE_EXT_OPT

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

LOG_EXT_LOGGER_PREFIX

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

GAppLogExtOptions

public GAppLogExtOptions(KeyValueCollection logExtOptions,
                         ILogger logger)
Parsing constructor of "log-extended" section of application Options.
 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");

 GAppLogExtOptions logExtOpts = new GAppLogExtOptions(logExtSection, null);
 

Parameters:
logExtOptions - the application "log-extended" Options section.
logger - optional "status" logger to print errors of options parsing methods.
See Also:
GAppLoggingOptions
Method Detail

clone

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

getLevelReassigns

public java.util.Map<java.lang.Integer,LmsLogLevel> getLevelReassigns()
Returns LMS events levels reassignment configuration.
It represents extended logging options like following:
 [log-extended]
   "level-reassign-14005" = "ALARM"
   "level-reassign-14006" = "ALARM"
 
This value is null if there are no reassignment declarations or reassignment is disabled with
 [log-extended]
   "level-reassign-disabled" = "true"
 

Returns:
map with levels reassignment declarations or null.

getCustomLoggers

public java.util.Map<java.lang.String,CustomLoggerExtConfig> getCustomLoggers()
Returns loggers customization options.
It represents extended logging options like following:
 [log-extended]
   "logger-psdk" = "com.genesyslab.platform: level=debug"
   "logger-apache" = "org.apache: level=error"
 
This sample represents a map with two elements:
   "com.genesyslab.platform" => CustomLoggerExtConfig(
                                       ID = "psdk",
                                       Name = "com.genesyslab.platform",
                                       Property["level"] = "debug"
                                ),
   "org.apache"              => CustomLoggerExtConfig(
                                       ID = "apache",
                                       Name = "org.apache",
                                       Property["level"] = "error"
                                )
 
This value is null if there are no loggers configuration declarations.

Returns:
map with loggers customization options or null.
See Also:
CustomLoggerExtConfig

parseLevelReassignments

protected java.util.Map<java.lang.Integer,LmsLogLevel> parseLevelReassignments(KeyValueCollection optsLogExt)
Extracts map of LMS events level reassignment configuration from "log-extended" section of the application configuration object.

Parameters:
optsLogExt - the extended log options of the application.
Returns:
filled map, or null if there are no reassignment declarations or reassignment is disabled.

parseCustomLoggers

protected java.util.Map<java.lang.String,CustomLoggerExtConfig> parseCustomLoggers(KeyValueCollection optsLogExt)
Parsing method for custom loggers declarations.

Parameters:
optsLogExt - the extended log options of the application.
Returns:
map with parsed loggers customization options.
See Also:
CustomLoggerExtConfig

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.