org.eclipse.actf.util.logging
Class LoggingUtil

java.lang.Object
  extended by org.eclipse.actf.util.logging.LoggingUtil

public final class LoggingUtil
extends Object

A set of static methods utilized by the IBM Reflexive GUI Builder. All parameters for the trace stream and level are also set and maintaned by this class

Author:
Mike Squillace

Field Summary
static int ALL
          Highest trace level: all information regarding process of GUI construction and execution and validation; includes: warnings and errors from interpreter engine and validator (if present and active) information regarding GUI construction (e.g. steps of algorithm, nodes being built) level 2 information + execution of code blocks and notices about instantiations of objects all level 3 information + constructors and methods being considered and arguments to chosen constructors and methods
static int ERRORS
          only errors are printed
static int FATAL
          only fatal errors and exception messages are printed
static int NONE
          only fatal errors and exception messages are printed
static int PROCESS_ALL
          information reported at previous levels + information about executable code and more details about the algorithm of construction
static int PROCESS_INFO
          information regarding the GUI construction and validation process including nodes being built and object instantiations
static int WARNINGS
          warnings and errors only
 
Constructor Summary
protected LoggingUtil()
           
 
Method Summary
static String arrayAsString(String[] str)
           
static void closeTracer()
           
static void endSubprocess()
          alert tracer that a process is ending.
static String escape(String s)
          Replace XML specific characters with entities.
static String firstCharToUpper(String str)
          converts the first character of the given string to uppper case
static Throwable getRootException(Throwable t)
          retreave the root exception of the given Throwable
static int getTraceLevel()
          get the current trace level
static IReporter getTracer()
          returns the active tracer
static void println(int level, String str)
          print the given information according to the given level.
static void println(String errorKey, String msg)
          output an error.
static void println(String errorKey, String msg, Throwable t)
          output an error.
static void println(String errorKey, Throwable t)
          output an error.
static void printParams(int level, Object[] params)
          print the members of the given array.
static void setTracer(int traceLevel, String traceStream)
          set the tracer using the given level and stream.
static void setTracer(IReporter reporter)
          set the trcer with the given reporter
static void startSubprocess(String id)
          alert tracer that a new process is beginning.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
only fatal errors and exception messages are printed

See Also:
Constant Field Values

FATAL

public static final int FATAL
only fatal errors and exception messages are printed

See Also:
Constant Field Values

ERRORS

public static final int ERRORS
only errors are printed

See Also:
Constant Field Values

WARNINGS

public static final int WARNINGS
warnings and errors only

See Also:
Constant Field Values

PROCESS_INFO

public static final int PROCESS_INFO
information regarding the GUI construction and validation process including nodes being built and object instantiations

See Also:
Constant Field Values

PROCESS_ALL

public static final int PROCESS_ALL
information reported at previous levels + information about executable code and more details about the algorithm of construction

See Also:
Constant Field Values

ALL

public static final int ALL
Highest trace level: all information regarding process of GUI construction and execution and validation; includes:

See Also:
Constant Field Values
Constructor Detail

LoggingUtil

protected LoggingUtil()
Method Detail

setTracer

public static void setTracer(int traceLevel,
                             String traceStream)
set the tracer using the given level and stream. The stream may be one of "stderr", "stdout", or a filename and the level parameter should be one of the public static field members of org.eclipse.actf.core.logging.Reporter. The trace is always an instance of org.eclipse.actf.core.logging.PrintWriterReporter.

Parameters:
traceLevel - -- a level between NONE and ALL
traceStream - -- one of stdout, stderr, or filename

setTracer

public static void setTracer(IReporter reporter)
set the trcer with the given reporter

Parameters:
reporter - -- reporter to be used as tracer

getTracer

public static IReporter getTracer()
returns the active tracer

Returns:
active tracer

closeTracer

public static void closeTracer()

getTraceLevel

public static int getTraceLevel()
get the current trace level

Returns:
current trace level

startSubprocess

public static void startSubprocess(String id)
alert tracer that a new process is beginning. A new process will be indicated in the trace stream with the given id appearing in square brackets ([...]) before any message.

Parameters:
id - -- process id

endSubprocess

public static void endSubprocess()
alert tracer that a process is ending. Processes are maintaned on a stack so that the last process initiated with the startSubprocess method will be terminated.

See Also:
startSubprocess(java.lang.String)

println

public static void println(int level,
                           String str)
print the given information according to the given level. All information associated with a level greater than or equal to the set trace level will be printed

Parameters:
level - -- level of given information
str - -- information to be printed

println

public static void println(String errorKey,
                           String msg)
output an error. The underlying reporter/tracer will use the appropriate error logger to display the error and, if desired, the stack trace.

Parameters:
errorKey - - error key as defined by public fields in org.eclipse.actf.core.logging.Reporter
msg - - message
See Also:
IReporter.setSourceID(String)

println

public static void println(String errorKey,
                           Throwable t)
output an error. The underlying reporter/tracer will use the appropriate error logger to display the error and, if desired, the stack trace.

Parameters:
errorKey - - error key as defined by public fields in org.eclipse.actf.core.logging.Reporter
t - - Throwable
See Also:
IReporter.setSourceID(String)

println

public static void println(String errorKey,
                           String msg,
                           Throwable t)
output an error. The underlying reporter/tracer will use the appropriate error logger to display the error and, if desired, the stack trace.

Parameters:
errorKey - - error key as defined by public fields in org.eclipse.actf.core.logging.Reporter
msg - -message
t - - Throwable
See Also:
IReporter.setSourceID(String)

printParams

public static void printParams(int level,
                               Object[] params)
print the members of the given array. This method is typically used in the trace by methods that wish to output the list of parameters given to a constructor or method.

Parameters:
level - -- level at which to print
params - -- parameters to be printed

firstCharToUpper

public static String firstCharToUpper(String str)
converts the first character of the given string to uppper case

Parameters:
str - -- a string
Returns:
str with its first character converted to upper case

arrayAsString

public static String arrayAsString(String[] str)

getRootException

public static Throwable getRootException(Throwable t)
retreave the root exception of the given Throwable

Parameters:
t - - throwable
Returns:
root exception of t or t if t has no cause

escape

public static String escape(String s)
Replace XML specific characters with entities.

Parameters:
s - text to fix