IBM WebSphere Application ServerTM
Release 8

com.ibm.uddi.promoter
Class PromoterLogger

java.lang.Object
  extended by com.ibm.uddi.promoter.PromoterLogger
All Implemented Interfaces:
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.


Field Summary
 
Fields inherited from interface com.ibm.uddi.promoter.PromoterConstants
BAD_ENTITY_MSG, CLASSPATH, CLP_FULLY_QUALIFIED_CLASSNAME, COMPLETED_OK, COMPLETED_WITH_ERRORS, CONFIGURATION_FILE_NAME, DATE_MASK, DB_DRIVER, DB_PASSWORD, DB_URL, DB_USERID, DEBUG_PREFIX, DEFINITION_FILE_ENCODING, DELETE_BINDING, DELETE_BUSINESS, DELETE_END, DELETE_SERVICE, DELETE_START, DELETE_TMODEL, DELIMITER_WITH_SPACE, DESERIALIZATION_END, DESERIALIZATION_START, ELEMENT_BINDING, ELEMENT_BUSINESS, ELEMENT_SERVICE, ELEMENT_TMODEL, ENTITY_BINDING, ENTITY_BUSINESS, ENTITY_DELIMITER, ENTITY_SERVICE, ENTITY_TMODEL, ENTRY_PREFIX, ERR_ARG_ALREADY_SPECIFIED, ERR_ARG_NOT_RECOGNISED, ERR_AUTO_COMMIT_OFF, ERR_BAD_ENTITY, ERR_BOOLEAN_PROPERTY, ERR_CANNOT_CONNECT_URL, ERR_CANNOT_WRITE_RESULTS, ERR_COMMIT_FAILED, ERR_CYCLE_IN_REF_TMODELS, ERR_DB_CONN_CLOSE, ERR_DB_CONN_FAILED, ERR_DB_DRIVER_LOAD_FAILED, ERR_DEFINITION_FILE_IOEXCEPTION, ERR_DEFINITION_FILE_NOT_FOUND, ERR_DEFINITION_FILE_READ_ERROR, ERR_DELETE_BINDING_FAILED, ERR_DELETE_BUSINESS_FAILED, ERR_DELETE_SERVICE_FAILED, ERR_DELETE_TMODEL_FAILED, ERR_DISCOVER_PUBLISHER_FAILED, ERR_ERROR_OCCURRED, ERR_EXCEPTION, ERR_FIND_BINDINGS_FAILED, ERR_FIND_BUSINESSES_FAILED, ERR_FIND_RELATED_BUSINESSES_FAILED, ERR_FIND_SERVICES_FAILED, ERR_FIND_TMODELS_FAILED, ERR_GET_AUTHINFO_FAILED, ERR_GET_BINDING_FAILED, ERR_GET_BUSINESS_FAILED, ERR_GET_SERVICE_FAILED, ERR_GET_TMODEL_FAILED, ERR_IMPORT_MISSING_DEF_FILE, ERR_INIT_PREPSTMT_FAILED, ERR_INQUIRYURL_MALFORMED, ERR_INTEGER_PROPERTY, ERR_INVALID_ENTITY, ERR_INVALID_FUNCTION, ERR_INVALID_KEY, ERR_JAVA_IO_ERROR, ERR_JSSEPROVIDER_NOT_ACCESSED, ERR_JSSEPROVIDER_NOT_FOUND, ERR_JSSEPROVIDER_NOT_INSTANTIATED, ERR_KEY_SPECIFIED, ERR_KEYFILE_IOEXCEPTION, ERR_KEYFILE_NOT_FOUND, ERR_KEYFILE_SPECIFIED, ERR_LOGGER_FILE_NOT_FOUND, ERR_MESSAGES_FILE_CLOSE, ERR_MISSING_FUNCTION, ERR_MISSING_NODEID, ERR_MISSING_PROPERTY, ERR_MISSING_VALUE, ERR_NO_KEYS, ERR_NO_PROPERTIES_FILE, ERR_ORPHANED_BINDING_STUB, ERR_ORPHANED_BUSINESS_STUB, ERR_ORPHANED_SERVICE_STUB, ERR_ORPHANED_TMODEL_STUB, ERR_OVERWRITE_BINDING, ERR_OVERWRITE_BUSINESS, ERR_OVERWRITE_SERVICE, ERR_OVERWRITE_TMODEL, ERR_PROMOTE_FAILED, ERR_PROPERTIES_FILE_IO, ERR_PROPERTIES_IOEXCEPTION, ERR_PUBLISHURL_MALFORMED, ERR_REPEATED_FUNCTION, ERR_ROLLBACK_FAILED, ERR_SAVE_BINDING_FAILED, ERR_SAVE_BINDING_NO_PARENT, ERR_SAVE_BUSINESS_FAILED, ERR_SAVE_SERVICE_FAILED, ERR_SAVE_SERVICE_NO_PARENT, ERR_SAVE_TMODEL_FAILED, ERR_SQL_EXCEPTION, ERR_STUB_BINDING_CREATE, ERR_STUB_BINDING_DELETE, ERR_STUB_BINDING_ERROR, ERR_STUB_BUSINESS_CREATE, ERR_STUB_BUSINESS_DELETE, ERR_STUB_CREATE_FAILED, ERR_STUB_SERVICE_CREATE, ERR_STUB_SERVICE_DELETE, ERR_STUB_SERVICE_ERROR, ERR_STUB_TMODEL_CREATE, ERR_STUB_TMODEL_DELETE, ERR_STUB_UNDO_FAILED, ERR_TRACE_FILE_CLOSE, ERR_TRANSPORT_EXCEPTION, ERR_UNEXPECTED_EXCEPTION, ERR_XML_DOC_CREATE_FAILED, ERR_XML_DOC_PARSE_FAILED, ERR_XML_PARSE_ERRORS, ERR_XML_PARSE_WARNINGS, EXIT_PREFIX, EXPORT_BINDING, EXPORT_BUSINESS, EXPORT_END, EXPORT_FIND_END, EXPORT_FIND_START, EXPORT_REFED_TMODEL, EXPORT_SERVICE, EXPORT_START, EXPORT_TMODEL, FROM_GET_URL, FROM_INQUIRY_URL, IMPORT_BINDING, IMPORT_BUSINESS, IMPORT_END, IMPORT_REFED_TMODEL, IMPORT_REFERENCED_ENTITIES, IMPORT_SERVICE, IMPORT_START, IMPORT_TMODEL, JAVA_COMMAND, JSSE_PROVIDER, MESSAGE_CREATED_BINDING_STUB, MESSAGE_CREATED_BUSINESS_STUB, MESSAGE_CREATED_SERVICE_STUB, MESSAGE_CREATED_TMODEL_STUB, MESSAGE_DELETED_BINDING_STUB, MESSAGE_DELETED_BUSINESS_STUB, MESSAGE_DELETED_SERVICE_STUB, MESSAGE_DELETED_TMODEL_STUB, MESSAGE_DETAIL, MESSAGE_IMPORT_END, MESSAGE_LOG_FILENAME, MESSAGE_NORMAL, messages, MESSAGES_FILE, NAMESPACE_DEFAULT, NAMESPACE_PREFIX, NAMESPACE_PROMOTER, NAMESPACE_UDDI, NAMESPACE_UDDI_PREFIX, NAMESPACE_XML, NORMAL_PREFIX, OVERWRITE, PROMOTER_ROOT_NAME, PROMOTING_ENTITY, PROPERTIES_HEADER, RESULTS_FILE_NAME, SCHEMA_FILE_PROMOTER, SCHEMA_FILE_UDDI, SCHEMA_FILE_XML, SECTION_BINDINGS, SECTION_BUSINESSES, SECTION_REFD_TMODELS, SECTION_SERVICES, SECTION_TMODELS, SECURE_CONNECTION, SERIALIZATION_END, SERIALIZATION_START, SOURCE_REGISTRY, STARTING_TOOL_BANNER, SUCCESSFUL, SYS_ID_NAME, SYS_PASSWORD_NAME, SYS_PROTOCOL_NAME, SYS_PROTOCOL_VALUE, SYS_TRANSPORT_NAME, SYS_TRANSPORT_VALUE, SYS_TRUST_STORE_NAME, SYS_TRUST_STORE_PASSWORD_NAME, TARGET_REGISTRY, TEMP_BUSINESS, TO_INQUIRY_URL, TO_PUBLISH_URL, TOOL_START, TRACE_DEBUG, TRACE_DETAIL, TRACE_LEVEL, TRACE_LOG_FILENAME, TRACE_NORMAL, TRACE_SEVERE, TRC_BINDING_NOT_IN_DEST, TRC_BUSINESS_NOT_IN_DEST, TRC_CREATED_BINDING, TRC_CREATED_BUSINESS_STUB, TRC_CREATED_SERVICE_STUB, TRC_CREATED_TMODEL_STUB, TRC_CREATING_BINDING, TRC_CREATING_BUSINESS_STUB, TRC_CREATING_SERVICE_STUB, TRC_CREATING_TMODEL_STUB, TRC_GET_BINDING, TRC_GET_BUSINESS, TRC_GET_SERVICE, TRC_GET_TMODEL, TRC_GOT_BINDING, TRC_GOT_BUSINESS, TRC_GOT_SERVICE, TRC_GOT_TMODEL, TRC_OVERWRITE_ON, TRC_PROMOTED_BINDING, TRC_PROMOTED_BUSINESS, TRC_PROMOTED_SERVICE, TRC_PROMOTED_TMODEL, TRC_PROMOTING_BINDING, TRC_PROMOTING_BUSINESS, TRC_PROMOTING_SERVICE, TRC_PROMOTING_TMODEL, TRC_REMOVING_DISCOS, TRC_SAVED_BINDING, TRC_SAVED_BUSINESS, TRC_SAVED_SERVICE, TRC_SAVED_TMODEL, TRC_SAVING_BINDING, TRC_SAVING_BUSINESS, TRC_SAVING_SERVICE, TRC_SAVING_TMODEL, TRC_SERVICE_NOT_IN_DEST, TRC_TMODEL_NOT_IN_DEST, TRUST_STORE_FILENAME, TRUST_STORE_PASSWORD, UDDI_ENTITY_DEFINITION_FILE, UDDI_PASSWORD, UDDI_USERID, VERBOSE, XML_FEATURE_NAMESPACES, XML_FEATURE_VALIDATION, XML_FEATURE_VALIDATION_SCHEMA, XML_PARSER_ERROR_PREFIX, XML_PARSER_FEATURE_UNREC, XML_PARSER_FEATURE_UNSUP, XML_PARSER_PROPERTY_UNREC, XML_PARSER_PROPERTY_UNSUP, XML_PARSER_WARNING_PREFIX, XML_PROPERTY_SCHEMA_LOCATION
 
Method Summary
 void cleanUp()
          Closes the OutputStreams used for message and trace logs.
protected  void finalize()
          In case the logger has not been cleaned up this should be called before it is garbage collected.
 int getCurrentLevel()
          Returns current trace detail level.
static PromoterLogger getLogger()
          Returns the single instance of PromoterLogger.
 void initialise(LoggerConfiguration loggerConfig)
          Uses LoggerConfiguration to initialise the logger.
 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.
 void logMessageToFileOnly(java.lang.String message)
          Prints a message to the messages file stream only.
 void setCurrentLevel(int level)
          Sets the detail level of trace.
 void setMessagesStream(java.io.PrintStream stream)
          Sets the Stream to be used for writing messages to.
 void setVerbose(boolean verbose)
          Sets detailed message output on.
 void trace(int traceLevel, java.lang.Object className, java.lang.String methodName, java.lang.String message)
          Traces a message from within a particular method.
 void trace(int traceLevel, java.lang.String className, java.lang.String methodName, java.lang.String message)
          Traces a message from within a particular method.
 void traceEntry(int traceLevel, java.lang.Object className, java.lang.String methodName)
          Traces entry of a method.
 void traceEntry(int traceLevel, java.lang.String className, java.lang.String methodName)
          Traces entry of a method.
 void traceException(int traceLevel, java.lang.Throwable throwable)
          Writes an exception to the trace log file.
 void traceExit(int traceLevel, java.lang.Object className, java.lang.String methodName)
          Traces exit of a method.
 void 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 OutputStreams 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).

IBM WebSphere Application ServerTM
Release 8