com.ibm.uddi.promoter

Class PromoterLogger

  • java.lang.Object
    • com.ibm.uddi.promoter.PromoterLogger
  • All Implemented Interfaces:
    com.ibm.uddi.promoter.CommandLineConstants, PromoterConstants


    public class PromoterLogger
    extends java.lang.Object
    implements PromoterConstants
    Manages the output of messages and trace.

    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.

    • Method Detail

      • getLogger

        public static PromoterLogger getLogger()
        Returns the single instance of PromoterLogger.

        Returns:
        PromoterLogger
      • initialise

        public void initialise(com.ibm.uddi.promoter.config.LoggerConfiguration loggerConfig)
                        throws com.ibm.uddi.promoter.exception.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:
        com.ibm.uddi.promoter.exception.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 com.ibm.uddi.promoter.exception.PromoterIOException
        Closes the OutputStreams used for message and trace logs.

        Throws:
        com.ibm.uddi.promoter.exception.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).
IBM WebSphere Application ServerTM
Release 8.5