com.ibm.uddi.promoter
Class PromoterLogger
- java.lang.Object
com.ibm.uddi.promoter.PromoterLogger
All implemented interfaces:
- public class PromoterLogger
- extends java.lang.Object
- implements PromoterConstants
All messages output by UDDI Utility Tools are national language messages. These messages will be written to a messages log file if that has been specified and/or a PrintStream if one has been configured.
Messages written to the message log file are prefixed by a timestamp. Messages written to the messages PrintStream are not prefixed with a timestamp.
Trace output is in English only. Exception stack traces are written to the trace log file only. Trace logging would normally only be required in exceptional circumstances to aid IBM support diagnosis of problems.
Field Summary
Method Summary
Modifier and Type | Method and Description |
---|---|
|
cleanUp()
Closes the
OutputStream s used for message and trace logs.
|
|
finalize()
In case the logger has not been cleaned up this should be called
before it is garbage collected.
|
|
getCurrentLevel()
Returns current trace detail level.
|
|
getLogger()
Returns the single instance of PromoterLogger.
|
|
initialise(LoggerConfiguration loggerConfig)
Uses
LoggerConfiguration to initialise the logger.
|
|
logMessage(java.lang.String messageKey,java.lang.String[] inserts,int level)
Writes an informational message to the message log and message stream, if they exist.
|
|
logMessageToFileOnly(java.lang.String message)
Prints a message to the messages file stream only.
|
|
setCurrentLevel(int level)
Sets the detail level of trace.
|
|
setMessagesStream(java.io.PrintStream stream)
Sets the Stream to be used for writing messages to.
|
|
setVerbose(boolean verbose)
Sets detailed message output on.
|
|
trace(int traceLevel,java.lang.Object className,java.lang.String methodName,java.lang.String message)
Traces a message from within a particular method.
|
|
trace(int traceLevel,java.lang.String className,java.lang.String methodName,java.lang.String message)
Traces a message from within a particular method.
|
|
traceEntry(int traceLevel,java.lang.Object className,java.lang.String methodName)
Traces entry of a method.
|
|
traceEntry(int traceLevel,java.lang.String className,java.lang.String methodName)
Traces entry of a method.
|
|
traceException(int traceLevel,java.lang.Throwable throwable)
Writes an exception to the trace log file.
|
|
traceExit(int traceLevel,java.lang.Object className,java.lang.String methodName)
Traces exit of a method.
|
|
traceExit(int traceLevel,java.lang.String className,java.lang.String methodName)
Traces exit of a method.
|
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail
getLogger
- public static PromoterLogger getLogger( )
Returns the single instance of PromoterLogger.
Returns:
PromoterLogger
initialise
- public void initialise(LoggerConfiguration loggerConfig)
- throws PromoterIOException
Uses
LoggerConfiguration
to initialise the logger.
The data is copied out of the configuration object so subsequent
changes to it's values will not affect the logger.
Parameters:
loggerConfig
- Throws:
PromoterIOException
setMessagesStream
- public void setMessagesStream(java.io.PrintStream stream)
Sets the Stream to be used for writing messages to.
Parameters:
stream
- setVerbose
- public void setVerbose(boolean verbose)
Sets detailed message output on.
Parameters:
verbose
- true
if detailed message should appear in the messages stream. logMessage
- public void logMessage(java.lang.String messageKey,
- java.lang.String[] inserts,
- int level)
Writes an informational message to the message log and message stream, if they exist.
The level parameter indicates whether a message is for normal or detail output.
Detail messages only appear on the message stream if the verbose property is true.
Messages are translated according to the user's locale.
Parameters:
messageKey
- Key into the messages resource. inserts
- level
- PromoterConstants.MESSAGE_NORMAL
or PromoterConstants.MESSAGE_DETAIL
logMessageToFileOnly
- public void logMessageToFileOnly( java.lang.String message)
Prints a message to the messages file stream only.
Parameters:
message
- traceEntry
- public void traceEntry(int traceLevel,
- java.lang.String className,
- java.lang.String methodName)
Traces entry of a method.
Parameters:
traceLevel
- PromoterConstants.TRACE_SEVERE
, PromoterConstants.TRACE_NORMAL
or PromoterConstants.TRACE_DETAIL
. className
- As a String, for class logging where 'this' isn't applicable methodName
- traceEntry
- public void traceEntry(int traceLevel,
- java.lang.Object className,
- java.lang.String methodName)
Traces entry of a method.
Parameters:
traceLevel
- PromoterConstants.TRACE_SEVERE
, PromoterConstants.TRACE_NORMAL
or PromoterConstants.TRACE_DETAIL
. className
- As an Object (typically as 'this
') methodName
- traceExit
- public void traceExit(int traceLevel,
- java.lang.String className,
- java.lang.String methodName)
Traces exit of a method.
Parameters:
traceLevel
- PromoterConstants.TRACE_SEVERE
, PromoterConstants.TRACE_NORMAL
or PromoterConstants.TRACE_DETAIL
. className
- As a String, for class logging where 'this' isn't applicable methodName
- traceExit
- public void traceExit(int traceLevel,
- java.lang.Object className,
- java.lang.String methodName)
Traces exit of a method.
Parameters:
traceLevel
- PromoterConstants.TRACE_SEVERE
, PromoterConstants.TRACE_NORMAL
or PromoterConstants.TRACE_DETAIL
. className
- As an Object (typically as 'this
') methodName
- trace
- public void trace(int traceLevel,
- java.lang.String className,
- java.lang.String methodName,
- java.lang.String message)
Traces a message from within a particular method.
Parameters:
traceLevel
- PromoterConstants.TRACE_SEVERE
, PromoterConstants.TRACE_NORMAL
or PromoterConstants.TRACE_DETAIL
. className
- As String methodName
- message
- trace
- public void trace(int traceLevel,
- java.lang.Object className,
- java.lang.String methodName,
- java.lang.String message)
Traces a message from within a particular method.
Parameters:
traceLevel
- PromoterConstants.TRACE_SEVERE
, PromoterConstants.TRACE_NORMAL
or PromoterConstants.TRACE_DETAIL
. className
- As Object (typically as 'this
'). methodName
- message
- traceException
- public void traceException(int traceLevel,
- java.lang.Throwable throwable)
Writes an exception to the trace log file.
Parameters:
traceLevel
- PromoterConstants.TRACE_SEVERE
, PromoterConstants.TRACE_NORMAL
or PromoterConstants.TRACE_DETAIL
. throwable
- cleanUp
- public void cleanUp()
- throws PromoterIOException
Closes the
OutputStream
s used for message and trace logs.
Throws:
PromoterIOException
finalize
- protected void finalize()
- throws java.lang.Throwable
In case the logger has not been cleaned up this should be called
before it is garbage collected.
Overrides:
finalize
in class java.lang.Object
Throws:
java.lang.Throwable
See Also:
Object.finalize()
setCurrentLevel
- public void setCurrentLevel(int level)
Sets the detail level of trace.
Parameters:
level
- Can be 0 (no logging) to 3 (highest detail). getCurrentLevel
- public int getCurrentLevel()
Returns current trace detail level.
Returns:
int Can be 0 (no logging) to 3 (highest detail).