com.ibm.rational.artifact.api.logging
Class LoggingUtilities

java.lang.Object
  extended bycom.ibm.rational.artifact.api.logging.LoggingUtilities

public class LoggingUtilities
extends java.lang.Object

LoggingUtilities is a class of static methods for logging information to the ClearQuest log files and optionally the Eclipse console. Constants in this class describe what type of action triggered the log event and where the messages should be logged. The following code fragment logs a success message to both the console and ClearQuest log files after updating a record:

 LoggingUtilities.fireMessageEvent(LoggingUtilities.COMMAND_TYPE_ACTION,
                                   "The record has been successfully updated.",
                                   LoggingUtilities.LOGGING_OPTION_CONSOLE_AND_LOG_FILES,
                                   "admin,7.0.0@SAMPL",
                                   "Defect",
                                   "SAMPL000001");
 

Author:
Nirav Sheth , Samuel Padgett

Field Summary
static int COMMAND_TYPE_ACTION
          An action on a record is being logged.
static int COMMAND_TYPE_CREATOR
          A new record is being logged.
static int COMMAND_TYPE_LOGIN
          A new connection is being logged.
static int COMMAND_TYPE_LOGOUT
          A disconnect is being logged.
static int COMMAND_TYPE_OTHER
          Some other event is being logged.
static int COMMAND_TYPE_QUERY_RESOURCE
          A query is being logged.
static int COMMAND_TYPE_SESSION_EXPIRED
          An expired session is being logged.
static int COMMAND_TYPE_SESSION_RESTORED
          A restored session is being logged.
static int LOGGING_OPTION_CONSOLE_AND_LOG_FILES
          LOGGING_OPTION_CONSOLE_AND_LOG_FILES works in the following manner: If an Exception event, then it logs the exception in the console view, Eclipse log file and ClearQuest Logger file.
static int LOGGING_OPTION_DEFAULT
          LOGGING_OPTION_DEFAULT works in the following manner: If an Exception event, then it logs the exception in the console view, Eclipse log file, ClearQuest Logger file and also displays a dialog to the user with the message from the exception.
static int LOGGING_OPTION_LOG_FILES_ONLY
          LOGGING_OPTION_LOG_FILES_ONLY works in the following manner: If an Exception event, then it logs the exception to Eclipse log file and ClearQuest Logger file If Error event, then it logs the the error to CM Logger file.
 
Constructor Summary
LoggingUtilities()
           
 
Method Summary
static void fireErrorEvent(int commandType, java.lang.String commandName, java.lang.String errorMessage)
          Logs an error using LOGGING_OPTION_DEFAULT.
static void fireErrorEvent(int commandType, java.lang.String commandName, java.lang.String errorMessage, int loggingOption)
          Logs an error.
static void fireErrorEvent(int commandType, java.lang.String commandName, java.lang.String errorMessage, int loggingOption, java.lang.String providerLocationInfo, java.lang.String recordType, java.lang.String recordID)
          Logs an Error
static void fireErrorEvent(int commandType, java.lang.String commandName, java.lang.String errorMessage, java.lang.String providerLocationInfo, java.lang.String recordType, java.lang.String recordID)
          Logs an error using LOGGING_OPTION_DEFAULT.
static void fireExceptionEvent(int commandType, java.lang.String commandName, java.lang.Throwable throwable)
          Logs an exception using LOGGING_OPTION_DEFAULT.
static void fireExceptionEvent(int commandType, java.lang.String commandName, java.lang.Throwable throwable, int loggingOption)
          Logs an exception.
static void fireExceptionEvent(int commandType, java.lang.String commandName, java.lang.Throwable throwable, int loggingOption, java.lang.String providerLocationInfo, java.lang.String recordType, java.lang.String recordID)
          Logs an exception.
static void fireExceptionEvent(int commandType, java.lang.String commandName, java.lang.Throwable throwable, java.lang.String providerLocationInfo, java.lang.String recordType, java.lang.String recordID)
          Logs an exception using LOGGING_OPTION_DEFAULT.
static void fireMessageEvent(int commandType, java.lang.String commandName, java.lang.String message)
          Logs a message event using LOGGING_OPTION_DEFAULT.
static void fireMessageEvent(int commandType, java.lang.String commandName, java.lang.String message, int loggingOption)
          Logs a message.
static void fireMessageEvent(int commandType, java.lang.String commandName, java.lang.String message, int loggingOption, java.lang.String providerLocationInfo, java.lang.String recordType, java.lang.String recordID)
          Logs a message.
static void fireMessageEvent(int commandType, java.lang.String commandName, java.lang.String message, java.lang.String providerLocationInfo, java.lang.String recordType, java.lang.String recordID)
          Logs a message using LOGGING_OPTION_DEFAULT.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMMAND_TYPE_ACTION

public static final int COMMAND_TYPE_ACTION
An action on a record is being logged.

See Also:
Constant Field Values

COMMAND_TYPE_QUERY_RESOURCE

public static final int COMMAND_TYPE_QUERY_RESOURCE
A query is being logged.

See Also:
Constant Field Values

COMMAND_TYPE_LOGIN

public static final int COMMAND_TYPE_LOGIN
A new connection is being logged.

See Also:
Constant Field Values

COMMAND_TYPE_LOGOUT

public static final int COMMAND_TYPE_LOGOUT
A disconnect is being logged.

See Also:
Constant Field Values

COMMAND_TYPE_CREATOR

public static final int COMMAND_TYPE_CREATOR
A new record is being logged.

See Also:
Constant Field Values

COMMAND_TYPE_SESSION_EXPIRED

public static final int COMMAND_TYPE_SESSION_EXPIRED
An expired session is being logged.

See Also:
Constant Field Values

COMMAND_TYPE_SESSION_RESTORED

public static final int COMMAND_TYPE_SESSION_RESTORED
A restored session is being logged.

See Also:
Constant Field Values

COMMAND_TYPE_OTHER

public static final int COMMAND_TYPE_OTHER
Some other event is being logged.

See Also:
Constant Field Values

LOGGING_OPTION_DEFAULT

public static final int LOGGING_OPTION_DEFAULT
LOGGING_OPTION_DEFAULT works in the following manner:
  • If an Exception event, then it logs the exception in the console view, Eclipse log file, ClearQuest Logger file and also displays a dialog to the user with the message from the exception.
  • If Error event, then it logs the the error in the console view, ClearQuest Logger file and also displays a dialog to the user with the error
  • If Message event, then it logs the message in the console view and ClearQuest Logger file.

    See Also:
    Constant Field Values

  • LOGGING_OPTION_LOG_FILES_ONLY

    public static final int LOGGING_OPTION_LOG_FILES_ONLY
    LOGGING_OPTION_LOG_FILES_ONLY works in the following manner:
  • If an Exception event, then it logs the exception to Eclipse log file and ClearQuest Logger file
  • If Error event, then it logs the the error to CM Logger file.
  • If Message event, then it logs the the error to CM Logger file.

    See Also:
    Constant Field Values

  • LOGGING_OPTION_CONSOLE_AND_LOG_FILES

    public static final int LOGGING_OPTION_CONSOLE_AND_LOG_FILES
    LOGGING_OPTION_CONSOLE_AND_LOG_FILES works in the following manner:
  • If an Exception event, then it logs the exception in the console view, Eclipse log file and ClearQuest Logger file.
  • If Error event, then it logs the the error in the console view and ClearQuest Logger file.
  • If Message event, then it logs the message in the console view and ClearQuest Logger file.

    See Also:
    Constant Field Values
  • Constructor Detail

    LoggingUtilities

    public LoggingUtilities()
    Method Detail

    fireExceptionEvent

    public static void fireExceptionEvent(int commandType,
                                          java.lang.String commandName,
                                          java.lang.Throwable throwable)
    Logs an exception using LOGGING_OPTION_DEFAULT.

    Parameters:
    commandType - the constant for the type of command that resulted in the exception
    throwable - the exception to log

    fireErrorEvent

    public static void fireErrorEvent(int commandType,
                                      java.lang.String commandName,
                                      java.lang.String errorMessage)
    Logs an error using LOGGING_OPTION_DEFAULT.

    Parameters:
    commandType - the constant for the type of command that resulted in the error
    errorMessage - the error message to log

    fireMessageEvent

    public static void fireMessageEvent(int commandType,
                                        java.lang.String commandName,
                                        java.lang.String message)
    Logs a message event using LOGGING_OPTION_DEFAULT.

    Parameters:
    commandType - the constant for the type of command that triggered this message
    message - the message to log

    fireExceptionEvent

    public static void fireExceptionEvent(int commandType,
                                          java.lang.String commandName,
                                          java.lang.Throwable throwable,
                                          int loggingOption)
    Logs an exception.

    Parameters:
    commandType - the constant for the type of command that resulted in the exception
    throwable - the exception to log
    loggingOption - the constant describing where to log this exception

    fireErrorEvent

    public static void fireErrorEvent(int commandType,
                                      java.lang.String commandName,
                                      java.lang.String errorMessage,
                                      int loggingOption)
    Logs an error.

    Parameters:
    commandType - the constant for the type of command that resulted in the error
    errorMessage - the error message to log
    loggingOption - the constant describing where to log this error

    fireMessageEvent

    public static void fireMessageEvent(int commandType,
                                        java.lang.String commandName,
                                        java.lang.String message,
                                        int loggingOption)
    Logs a message.

    Parameters:
    commandType - the constant for the type of command that triggered this message
    message - the message to log
    loggingOption - the constant describing where to log this message

    fireExceptionEvent

    public static void fireExceptionEvent(int commandType,
                                          java.lang.String commandName,
                                          java.lang.Throwable throwable,
                                          java.lang.String providerLocationInfo,
                                          java.lang.String recordType,
                                          java.lang.String recordID)
    Logs an exception using LOGGING_OPTION_DEFAULT.

    Parameters:
    commandType - the constant for the type of command that triggered this exception
    throwable - the exception to log
    providerLocationInfo - the location of the record. Must be specified in this format: <username>,<db_set_name>@<database_name> (for example, admin,7.0.0@SAMPL)
    recordType - the record type in the database
    recordID - the record ID in the database

    fireErrorEvent

    public static void fireErrorEvent(int commandType,
                                      java.lang.String commandName,
                                      java.lang.String errorMessage,
                                      java.lang.String providerLocationInfo,
                                      java.lang.String recordType,
                                      java.lang.String recordID)
    Logs an error using LOGGING_OPTION_DEFAULT.

    Parameters:
    commandType - the constant for the type of command that triggered this exception
    errorMessage - the error message to log
    providerLocationInfo - the location of the record. Must be specified in this format: <username>,<db_set_name>@<database_name> (for example, admin,7.0.0@SAMPL)
    recordType - the record type in the database
    recordID - the record ID in the database

    fireMessageEvent

    public static void fireMessageEvent(int commandType,
                                        java.lang.String commandName,
                                        java.lang.String message,
                                        java.lang.String providerLocationInfo,
                                        java.lang.String recordType,
                                        java.lang.String recordID)
    Logs a message using LOGGING_OPTION_DEFAULT.

    Parameters:
    commandType - the constant for the type of command that triggered this exception
    message - the message to log
    providerLocationInfo - the location of the record. Must be specified in this format: <username>,<db_set_name>@<database_name> (for example, admin,7.0.0@SAMPL)
    recordType - the record type in the database
    recordID - the record ID in the database

    fireExceptionEvent

    public static void fireExceptionEvent(int commandType,
                                          java.lang.String commandName,
                                          java.lang.Throwable throwable,
                                          int loggingOption,
                                          java.lang.String providerLocationInfo,
                                          java.lang.String recordType,
                                          java.lang.String recordID)
    Logs an exception.

    Parameters:
    commandType - the constant for the type of command that triggered this exception
    throwable - the exception to log
    loggingOption - where to log the exception
    providerLocationInfo - the location of the record. Must be specified in this format: <username>,<db_set_name>@<database_name> (for example, admin,7.0.0@SAMPL)
    recordType - the record type in the database
    recordID - the record ID in the database

    fireErrorEvent

    public static void fireErrorEvent(int commandType,
                                      java.lang.String commandName,
                                      java.lang.String errorMessage,
                                      int loggingOption,
                                      java.lang.String providerLocationInfo,
                                      java.lang.String recordType,
                                      java.lang.String recordID)
    Logs an Error

    Parameters:
    commandType - the constant for the type of command that triggered this exception
    errorMessage - the error message to log
    loggingOption - where to log the error message
    providerLocationInfo - the location of the record. Must be specified in this format: <username>,<db_set_name>@<database_name> (for example, admin,7.0.0@SAMPL)
    recordType - the record type in the database
    recordID - the record ID in the database

    fireMessageEvent

    public static void fireMessageEvent(int commandType,
                                        java.lang.String commandName,
                                        java.lang.String message,
                                        int loggingOption,
                                        java.lang.String providerLocationInfo,
                                        java.lang.String recordType,
                                        java.lang.String recordID)
    Logs a message.

    Parameters:
    commandType - the constant for the type of command that triggered this exception
    message - the message to log
    loggingOption - where to log the message
    providerLocationInfo - the location of the record. Must be specified in this format: <username>,<db_set_name>@<database_name> (for example, admin,7.0.0@SAMPL)
    recordType - the record type in the database
    recordID - the record ID in the database