com.ibm.etill.framework.log
Class ErrorLog

java.lang.Object
  |
  +--com.ibm.etill.framework.log.ErrorLog

public class ErrorLog
extends Object

Provides the methods required to send messages to the Commerce Payments error log. Since ErrorLog only contains static methods and no instance variables, it is never instantiated.

All of the ErrorLog facilities are internationalized since message contents are read from a Properties file (through a ResourceBundle) which can be easily translated.

All the logging will be directed to the WebSphere Application Server activity.log file.

Methods are also provided to extract messages from the specified properties files into a String, rather than logging or displaying them. This can be useful for cassettes that want to put translated messages in places other than the log file.

The ErrorLog file (activity.log) grows arbitrarily large, so it needs to be manually pruned periodically.


Constructor Summary
ErrorLog()
           
 
Method Summary
static void createResourceBundle(String cassette)
          The Framework calls this method to create a resource bundle for the specified cassette.
static void log(String cassette, String messageNumber)
          Logs a message with no substitutions.
static void log(String cassette, String messageNumber, Vector inserts)
          Logs a message with the specified list of substitutions.
static void logError(String cassette, String messageNumber, Throwable throwable)
          Logs a message with no substitutions, followed by a Java stack trace from the specified exception object.
static void logError(String cassette, String messageNumber, Throwable throwable, Object[] parms)
          Logs an error message with an array substitutions, followed optionally by a Java stack trace from the specified exception object.
static void logError(String cassette, String messageNumber, Throwable throwable, String subst1)
          Logs a message with one substitution, followed by a Java stack trace from the specified exception object.
static void logError(String cassette, String messageNumber, Throwable throwable, String subst1, String subst2)
          Logs a message with two substitutions, followed by a Java stack trace from the specified exception object.
static void logError(String cassette, String messageNumber, Throwable throwable, String subst1, String subst2, String subst3)
          Logs a message with three substitutions, followed by a Java stack trace from the specified exception object.
static void logError(String cassette, String messageNumber, Throwable throwable, String subst1, String subst2, String subst3, String subst4)
          Logs a message with four substitutions, followed by a Java stack trace from the specified exception object.
static void logError(String cassette, String messageNumber, Throwable throwable, String subst1, String subst2, String subst3, String subst4, String subst5)
          Logs a message with five substitutions, followed by a Java stack trace from the specified exception object.
static void logError(String cassette, String messageNumber, Throwable throwable, Vector inserts)
          Logs a message with a Vector of substitutions, followed optionally by a Java stack trace from the specified exception object.
static void logErrorMessage(int cassette, String messageNumber, Vector inserts)
          Deprecated. use logError methods instead
static void logInfo(String cassette, String messageNumber, Object[] parms)
          Logs an informational message with an array substitutions.
static void logWarn(String cassette, String messageNumber, Object[] parms)
          Logs a warning message with an array substitutions.
static String lookupMessage(String cassette, String messageNumber)
          Returns the message, including the message identifier, without substitutions, as a String.
static String lookupMessage(String cassette, String messageNumber, Object[] parms)
          Returns the message, including the message identifier and substitutions, as a String.
static String lookupMessage(String cassette, String messageNumber, Vector inserts)
          Returns the message, including the message identifier and substitutions, as a String.
static String lookupMessageText(String cassette, String messageNumber)
          Returns the message text (without the message identifier), without substitutions, as a String.
static String lookupMessageText(String cassette, String messageNumber, Vector inserts)
          Returns the message text (without the message identifier), including substitutions, as a String.
static void printStackTrace(Throwable throwable)
          Logs a Java stack trace from the specified exception object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorLog

public ErrorLog()
Method Detail

createResourceBundle

public static void createResourceBundle(String cassette)
The Framework calls this method to create a resource bundle for the specified cassette. Cassettes should not call this method.
Parameters:
cassette - the name of the cassette. This will also serve as the resource bundle identifier.

log

public static final void log(String cassette,
                             String messageNumber)
Logs a message with no substitutions.
Parameters:
cassette - the name of the cassette. This also serves as the resource bundle identifier.
messageNumber - the 4 digit message number that identifies the message to be recorded to the log.

log

public static final void log(String cassette,
                             String messageNumber,
                             Vector inserts)
Logs a message with the specified list of substitutions.
Parameters:
cassette - the name of the cassette. This also serves as the resource bundle identifier.
messageNumber - the 4 digit message number that identifies the message to be recorded to the log.
inserts - a Vector of Strings containing the list of substitutions in the order in which they will appear in the message.

logError

public static final void logError(String cassette,
                                  String messageNumber,
                                  Throwable throwable)
Logs a message with no substitutions, followed by a Java stack trace from the specified exception object.
Parameters:
cassette - the name of the cassette. This also serves as the resource bundle identifier.
messageNumber - the 4 digit message number that identifies the message to be recorded to the log.
throwable - a Throwable object whose Java stack trace will be logged after the message.

logError

public static final void logError(String cassette,
                                  String messageNumber,
                                  Throwable throwable,
                                  String subst1)
Logs a message with one substitution, followed by a Java stack trace from the specified exception object.
Parameters:
cassette - the name of the cassette. This also serves as the resource bundle identifier.
messageNumber - the 4 digit message number that identifies the message to be recorded to the log.
throwable - a Throwable object whose Java stack trace will be logged after the message.
subst1 - the substitution text.

logError

public static final void logError(String cassette,
                                  String messageNumber,
                                  Throwable throwable,
                                  String subst1,
                                  String subst2)
Logs a message with two substitutions, followed by a Java stack trace from the specified exception object.
Parameters:
cassette - the name of the cassette. This also serves as the resource bundle identifier.
messageNumber - the 4 digit message number that identifies the message to be recorded to the log.
throwable - a Throwable object whose Java stack trace will be logged after the message.
subst1 - the text of the first substitution.
subst2 - the text of the second substitution.

logError

public static final void logError(String cassette,
                                  String messageNumber,
                                  Throwable throwable,
                                  String subst1,
                                  String subst2,
                                  String subst3)
Logs a message with three substitutions, followed by a Java stack trace from the specified exception object.
Parameters:
cassette - the name of the cassette. This also serves as the resource bundle identifier.
messageNumber - the 4 digit message number that identifies the message to be recorded to the log.
throwable - a Throwable object whose Java stack trace will be logged after the message.
subst1 - the text of the first substitution.
subst2 - the text of the second substitution.
subst3 - the text of the third substitution.

logError

public static void logError(String cassette,
                            String messageNumber,
                            Throwable throwable,
                            String subst1,
                            String subst2,
                            String subst3,
                            String subst4)
Logs a message with four substitutions, followed by a Java stack trace from the specified exception object.
Parameters:
cassette - the name of the cassette. This also serves as the resource bundle identifier.
messageNumber - the 4 digit message number that identifies the message to be recorded to the log.
throwable - a Throwable object whose Java stack trace will be logged after the message.
subst1 - the text of the first substitution.
subst2 - the text of the second substitution.
subst3 - the text of the third substitution.
subst4 - the text of the fourth substitution.

logError

public static final void logError(String cassette,
                                  String messageNumber,
                                  Throwable throwable,
                                  String subst1,
                                  String subst2,
                                  String subst3,
                                  String subst4,
                                  String subst5)
Logs a message with five substitutions, followed by a Java stack trace from the specified exception object.
Parameters:
cassette - the name of the cassette. This also serves as the resource bundle identifier.
messageNumber - the 4 digit message number that identifies the message to be recorded to the log.
throwable - a Throwable object whose Java stack trace will be logged after the message.
subst1 - the text of the first substitution.
subst2 - the text of the second substitution.
subst3 - the text of the third substitution.
subst4 - the text of the fourth substitution.
subst5 - the text of the fifth substitution.

logError

public static final void logError(String cassette,
                                  String messageNumber,
                                  Throwable throwable,
                                  Vector inserts)
Logs a message with a Vector of substitutions, followed optionally by a Java stack trace from the specified exception object.
Parameters:
cassette - the name of the cassette. This also serves as the resource bundle identifier.
messageNumber - the 4 digit message number that identifies the message to be recorded to the log.
throwable - a Throwable object whose Java stack trace will be logged after the message.
inserts - a Vector of Strings containing the list of substitutions in the order in which they will appear in the message.

logError

public static final void logError(String cassette,
                                  String messageNumber,
                                  Throwable throwable,
                                  Object[] parms)
Logs an error message with an array substitutions, followed optionally by a Java stack trace from the specified exception object.
Parameters:
cassette - the name of the cassette. This also serves as the resource bundle identifier.
messageNumber - the 4 digit message number that identifies the message to be recorded to the log.
throwable - a Throwable object whose Java stack trace will be logged after the message.
parms - an array of Strings containing the list of substitutions in the order in which they will appear in the message.

logWarn

public static final void logWarn(String cassette,
                                 String messageNumber,
                                 Object[] parms)
Logs a warning message with an array substitutions.
Parameters:
cassette - the name of the cassette. This also serves as the resource bundle identifier.
messageNumber - the 4 digit message number that identifies the message to be recorded to the log.
throwable - a Throwable object whose Java stack trace will be logged after the message.
parms - an array of Strings containing the list of substitutions in the order in which they will appear in the message.

logInfo

public static final void logInfo(String cassette,
                                 String messageNumber,
                                 Object[] parms)
Logs an informational message with an array substitutions.
Parameters:
cassette - the name of the cassette. This also serves as the resource bundle identifier.
messageNumber - the 4 digit message number that identifies the message to be recorded to the log.
throwable - a Throwable object whose Java stack trace will be logged after the message.
parms - an array of Strings containing the list of substitutions in the order in which they will appear in the message.

printStackTrace

public static void printStackTrace(Throwable throwable)
Logs a Java stack trace from the specified exception object.
Parameters:
throwable - a Throwable object whose Java stack trace will be logged after the message.

logErrorMessage

public static void logErrorMessage(int cassette,
                                   String messageNumber,
                                   Vector inserts)
Deprecated. use logError methods instead

Logs an error message with an array substitutions, followed optionally by a Java stack trace from the specified exception object. Cassettes should not use this method.
Parameters:
cassette - an int that contains an index representing the resourcebundle that contains the message. (This index is only available within the Framework. Cassettes should not attempt to call this method).
messageNumber - the 4 digit message number that identifies the message to be recorded to the log.
inserts - a Vector of Strings containing the list of substitutions in the order in which they will appear in the message.

lookupMessage

public static String lookupMessage(String cassette,
                                   String messageNumber)
Returns the message, including the message identifier, without substitutions, as a String.
Parameters:
cassette - the name of the cassette. This also serves as the resource bundle identifier.
messageNumber - the 4 digit message number that identifies the message to be recorded to the log.
Returns:
String the message text, with no substitutions, prefixed by the message identifier.

lookupMessage

public static String lookupMessage(String cassette,
                                   String messageNumber,
                                   Object[] parms)
Returns the message, including the message identifier and substitutions, as a String.
Parameters:
cassette - the name of the cassette. This also serves as the resource bundle identifier.
messageNumber - the 4 digit message number that identifies the message to be recorded to the log.
parms - an Array of Objects containing the list of substitutions in the order in which they will appear in the message.
Returns:
String the message text, with substitutions, prefixed by the message identifier.

lookupMessage

public static String lookupMessage(String cassette,
                                   String messageNumber,
                                   Vector inserts)
Returns the message, including the message identifier and substitutions, as a String.
Parameters:
cassette - the name of the cassette. This also serves as the resource bundle identifier.
messageNumber - the 4 digit message number that identifies the message to be recorded to the log.
inserts - a Vector of Strings containint the list of substitutions in the order in which they will appear in the message.
Returns:
String the message text, with substitutions, prefixed by the message identifier.

lookupMessageText

public static String lookupMessageText(String cassette,
                                       String messageNumber)
Returns the message text (without the message identifier), without substitutions, as a String.
Parameters:
cassette - the name of the cassette. This also serves as the resource bundle identifier.
messageNumber - the 4 digit message number that identifies the message to be recorded to the log.
Returns:
String the message text, with no substitutions or prefix.

lookupMessageText

public static String lookupMessageText(String cassette,
                                       String messageNumber,
                                       Vector inserts)
Returns the message text (without the message identifier), including substitutions, as a String.
Parameters:
cassette - the name of the cassette. This also serves as the resource bundle identifier.
messageNumber - the 4 digit message number that identifies the message to be recorded to the log.
inserts - a Vector of Strings containint the list of substitutions in the order in which they will appear in the message.
Returns:
String the message text, with substitutions, without any prefix.