com.waveset.logging.trace
Class TraceConfig

java.lang.Object
  extended bycom.waveset.util.AbstractXmlObject
      extended bycom.waveset.object.GenericObject
          extended bycom.waveset.logging.trace.TraceConfig
All Implemented Interfaces:
java.util.Map, javax.naming.Referenceable, XmlObject

public class TraceConfig
extends GenericObject


Nested Class Summary
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
protected static boolean _debug
           
static java.lang.String code_id
           
static java.lang.String DATE_FORMAT
           
static java.lang.String DESTINATION
          Key to property that specifies destination override (e.g., trace.destination=STDOUT).
static java.lang.String GLOBAL
           
static java.lang.String IS_LOGGING
           
static java.lang.String MAX_FAILURES
           
static java.lang.String MAX_FILE_SIZE
           
static java.lang.String MAX_FILES
           
static java.lang.String MAX_METHOD_CACHE
          Key to property that specifies size of method level cache (e.g., trace.methodLevelCacheSize=1000).
static java.lang.String MODE
           
static java.lang.String MODE_ASYNC
           
static java.lang.String MODE_SYNC
           
static java.lang.String TIME_FORMAT
           
static java.lang.String TRACE_CONFIG
           
static java.lang.String TRACE_DESTINATION
          Key to property that specifies destination override (e.g., trace.destination=STDOUT).
static java.lang.String TRACE_ENABLED
          Key to property that specifies whether trace is enabled (e.g., trace.enabled=true).
static java.lang.String TRACE_FILE
           
static java.lang.String TRACE_LEVEL
          Key to property that specifies global trace level (e.g., trace.level=3).
static java.lang.String TRACE_LEVEL_DOT
          Key to property that specifies scope trace level (e.g., trace.level=3).
static java.lang.String TRACE_LEVELS
           
 
Fields inherited from class com.waveset.object.GenericObject
ATT_ID, ATT_NAME, ATT_TYPE, ATT_VALUE, EL_ATTRIBUTE, EL_FORMREF, ELEMENT, FLATTEN_ALL, FLATTEN_NOTHING, FLATTEN_OBJECT_LISTS, SYN_MISMATCHED_NAMES, SYN_MISPLACED_DOT, SYN_MISPLACED_LBRACKET, SYN_NAMED_LIST, SYN_NO_DOT, SYN_NO_GEO, SYN_NO_INDEX, SYN_NO_LIST, SYN_NO_NAME, SYN_NO_TARGET
 
Fields inherited from class com.waveset.util.AbstractXmlObject
_trace
 
Constructor Summary
TraceConfig()
          Create a default configuration object.
TraceConfig(GenericObject sysConfig)
          Use the System configuration object to get the trace config called by WSTrace when a configuration change is requested.
 
Method Summary
 void clearLevel(java.lang.String scope)
          Remove any property specifying a trace level for the (precise) scope specified.
 void clearLevel(java.lang.String scope, boolean bInclusive)
          Remove any property specifying a trace level for the scope specified.
 java.lang.String getDateFormat()
          Get the date format used in the trace files.
 java.lang.String getDestination()
          Get the current destination, setting.
 java.lang.String getIsLogging()
          Switch which will determine if any of the trace code is executed.
 java.lang.String getLevel(java.lang.String scope)
          Get the level specified for the given scope.
 java.lang.String getMaxFailures()
          Get the max number of handler failures before we automatically stop looging to a trace device.
 java.lang.String getMaxFiles()
          Get the max number of files to create during trace.
 java.lang.String getMaxFileSize()
          Get the max size of each trace file.
 java.lang.String getMaxMethodCacheSize()
          Get the max size of method cache.
 java.util.Map getMethodTraceLevels()
           
 java.lang.String getMode()
          Get the current logger mode, there are two modes synchronous and asynchronous.
 java.lang.String getNameSpace()
          Get the current namespace.
 java.lang.String getTimeFormat()
          Get the time format used in the trace files.
 java.lang.String getTraceFileName()
          Get the file and path to the trace file that will be written.
 boolean isLogging()
          Switch which will determine if any of the trace code is executed.
 void listLevels(java.io.PrintWriter out, java.lang.String scope)
          Display the trace level settings that are relevant to the specified scope.
 void listLevels(java.io.PrintWriter out, java.lang.String scope, boolean bInclusive)
          Display the trace level settings that are relevant to the specified scope.
 void put(java.lang.String key, java.lang.Object value)
          Private method to allow concationation of the objects current namespace.
 boolean serverConfigExists(java.lang.String serverName)
          Test the trace configurations and see if a config exists supplied server.
 void setDateFormat(java.lang.String dateFormat)
          Set the date format used in the trace files.
 void setDestination(java.lang.String destination)
          Set the current destination, setting.
 void setIsLogging(java.lang.String isLogging)
          Set the logging switch.
 void setLevel(int level, java.lang.String scope)
           
 void setMaxFialures(java.lang.String max)
          Set the max number of handler failures before we automatically stop looging to a trace device.
 void setMaxFiles(java.lang.String max)
          Sets the max number of files to create during trace.
 void setMaxFileSize(java.lang.String size)
          Set the max size of each trace file in KB
 void setMaxMethodCacheSize(java.lang.String max)
          Sets the max number of items in the method cache;
 void setMethodTraceLevels(java.util.Map levels)
          Set the map of method trace levels
 void setMode(java.lang.String mode)
          Set the current logger mode, there are two modes synchronous and asynchronous.
 void setNameSpace(java.lang.String nameSpace)
          This method sets the namesspace the trace config will use, essentially this names which nested object to use when making changes to the trace configuration.
 void setTimeFormat(java.lang.String timeFormat)
          Set the time format used in the trace files.
 void setTraceFile(java.lang.String file)
          Set the file and path to the trace file that will be written.
 void showLevel(java.io.PrintWriter out, java.lang.String scope)
          Display the trace level setting in effect for the specified scope.
 
Methods inherited from class com.waveset.object.GenericObject
add, addAlias, assimilate, assimilateModifications, browse, clear, clearAliases, containsKey, containsValue, dumpMap, entrySet, filter, findObject, findObject, get, getAttributes, getBoolean, getDate, getDate, getDate, getElementName, getEncrypted, getForm, getFormRef, getId, getInt, getList, getListOfStrings, getLocal, getLong, getName, getObject, getObjectCreateIfNull, getString, isEmpty, keySet, main, parseXml, parseXml, println, put, put, put, put, putAll, putLocal, remove, removeLocal, setAliases, setAttributes, setForm, setFormRef, setId, setIgnoreForm, setName, size, sort, sort, test1, test2, test3, toDisplayString, toDisplayString, toMap, toMap, toMap, toMap, toMap, toMap, toString, toXml, toXmlNoForm, toXmlNormalized, toXmlNormalized, toXmlNormalized, trace, trace, values
 
Methods inherited from class com.waveset.util.AbstractXmlObject
addXmlHeader, cloneObject, dump, dumpFile, getReference, println, setTrace, toIdentityString, toVerboseString, toVerboseString, toXml, toXml, toXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

code_id

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

_debug

protected static boolean _debug

TRACE_CONFIG

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

MODE_SYNC

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

MODE_ASYNC

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

IS_LOGGING

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

TRACE_FILE

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

TRACE_LEVELS

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

TIME_FORMAT

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

DATE_FORMAT

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

MAX_FILE_SIZE

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

MAX_FILES

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

MODE

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

MAX_FAILURES

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

MAX_METHOD_CACHE

public static final java.lang.String MAX_METHOD_CACHE
Key to property that specifies size of method level cache (e.g., trace.methodLevelCacheSize=1000).

See Also:
Constant Field Values

DESTINATION

public static final java.lang.String DESTINATION
Key to property that specifies destination override (e.g., trace.destination=STDOUT).

See Also:
Constant Field Values

TRACE_ENABLED

public static final java.lang.String TRACE_ENABLED
Key to property that specifies whether trace is enabled (e.g., trace.enabled=true).

See Also:
Constant Field Values

TRACE_DESTINATION

public static final java.lang.String TRACE_DESTINATION
Key to property that specifies destination override (e.g., trace.destination=STDOUT).

See Also:
Constant Field Values

TRACE_LEVEL

public static final java.lang.String TRACE_LEVEL
Key to property that specifies global trace level (e.g., trace.level=3).

See Also:
Constant Field Values

TRACE_LEVEL_DOT

public static final java.lang.String TRACE_LEVEL_DOT
Key to property that specifies scope trace level (e.g., trace.level=3).

See Also:
Constant Field Values

GLOBAL

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

TraceConfig

public TraceConfig()
Create a default configuration object. Read System properties, ( System.getProperty) for default over-rides. Build a complete object here so that when these are created they can easily be edited from the xml. NOTE: Hard coded default should always indicate trace is off ( isLoggging=false ) for performance sake. Allowable system properties are: trace.enabled - true indicates to enable trace. trace.methods - comma separated list of class/package or methods to trace. Defaults to com.waveset if trace.enabled=true. trace.level - indicates which level to trace. Defaults to 4 if trace.enabled=true. This level will apply to ALL items in the trace.methods list. trace.destination - indicates where trace should be written. Options are file and stdout.. Default to file. trace.filename - indicates the filename to trace. Only applicable if trace.destination set to file. Defaults to $WSHOME/config/WSTrace.log


TraceConfig

public TraceConfig(GenericObject sysConfig)
Use the System configuration object to get the trace config called by WSTrace when a configuration change is requested.

Method Detail

setNameSpace

public void setNameSpace(java.lang.String nameSpace)
This method sets the namesspace the trace config will use, essentially this names which nested object to use when making changes to the trace configuration.


getNameSpace

public java.lang.String getNameSpace()
Get the current namespace.


put

public void put(java.lang.String key,
                java.lang.Object value)
Private method to allow concationation of the objects current namespace.


setLevel

public void setLevel(int level,
                     java.lang.String scope)

clearLevel

public void clearLevel(java.lang.String scope)
Remove any property specifying a trace level for the (precise) scope specified.


clearLevel

public void clearLevel(java.lang.String scope,
                       boolean bInclusive)
Remove any property specifying a trace level for the scope specified.

Parameters:
bInclusive - - if true, clear any trace level setting at or below the specified scope. Otherwise, clear only the trace level setting (if any) for the precisescope specified.

showLevel

public void showLevel(java.io.PrintWriter out,
                      java.lang.String scope)
Display the trace level setting in effect for the specified scope.


listLevels

public void listLevels(java.io.PrintWriter out,
                       java.lang.String scope)
Display the trace level settings that are relevant to the specified scope.

This includes the entry that determines the trace level in effect for the specified scope, as well as any entry that sets a trace level within that scope.


listLevels

public void listLevels(java.io.PrintWriter out,
                       java.lang.String scope,
                       boolean bInclusive)
Display the trace level settings that are relevant to the specified scope.

This includes the entry that determines the trace level in effect for the specified scope, as well as any entry that sets a trace level within that scope.


getLevel

public java.lang.String getLevel(java.lang.String scope)
Get the level specified for the given scope.


isLogging

public boolean isLogging()
Switch which will determine if any of the trace code is executed. This should ALWAYS default to off for performance sake. The behavior of getBoolean is the if its not "true", it then it will return false.


getIsLogging

public java.lang.String getIsLogging()
Switch which will determine if any of the trace code is executed. For use in the ui where we are dealing with strings.


setIsLogging

public void setIsLogging(java.lang.String isLogging)
Set the logging switch.


getMethodTraceLevels

public java.util.Map getMethodTraceLevels()
Returns:
a map containing all the methods to trace

setMethodTraceLevels

public void setMethodTraceLevels(java.util.Map levels)
Set the map of method trace levels


setMaxFileSize

public void setMaxFileSize(java.lang.String size)
Set the max size of each trace file in KB


getMaxFileSize

public java.lang.String getMaxFileSize()
Get the max size of each trace file. Default 512KB


setMaxFiles

public void setMaxFiles(java.lang.String max)
Sets the max number of files to create during trace.


getMaxFiles

public java.lang.String getMaxFiles()
Get the max number of files to create during trace. Default is 2


getMaxMethodCacheSize

public java.lang.String getMaxMethodCacheSize()
Get the max size of method cache. Default 1000


setMaxMethodCacheSize

public void setMaxMethodCacheSize(java.lang.String max)
Sets the max number of items in the method cache;


getTraceFileName

public java.lang.String getTraceFileName()
Get the file and path to the trace file that will be written. Defaults to $WSHOME/config otherwise CWD/WStrace.log


setTraceFile

public void setTraceFile(java.lang.String file)
Set the file and path to the trace file that will be written.


getTimeFormat

public java.lang.String getTimeFormat()
Get the time format used in the trace files. Defaults to HH:mm:ss.SSS.


setTimeFormat

public void setTimeFormat(java.lang.String timeFormat)
Set the time format used in the trace files. Defaults to HH:mm:ss.SSS.


getDateFormat

public java.lang.String getDateFormat()
Get the date format used in the trace files. Defaults to yyyyMMdd


setDateFormat

public void setDateFormat(java.lang.String dateFormat)
Set the date format used in the trace files. Defaults to yyyyMMdd


getDestination

public java.lang.String getDestination()
Get the current destination, setting. Either file or stdout.


setDestination

public void setDestination(java.lang.String destination)
Set the current destination, setting. Defaults to file, but can be either file or stdout to write to a file.


getMode

public java.lang.String getMode()
Get the current logger mode, there are two modes synchronous and asynchronous.


setMode

public void setMode(java.lang.String mode)
Set the current logger mode, there are two modes synchronous and asynchronous. If in synchronous mode trace calls are written before the code continues, otherwise in asynchronous mode there will be a slight lag in the trace written but you should see a performance increase. The default mode is synchronous.


getMaxFailures

public java.lang.String getMaxFailures()
Get the max number of handler failures before we automatically stop looging to a trace device. Defaults value is 10.


setMaxFialures

public void setMaxFialures(java.lang.String max)
Set the max number of handler failures before we automatically stop looging to a trace device.


serverConfigExists

public boolean serverConfigExists(java.lang.String serverName)
Test the trace configurations and see if a config exists supplied server.