com.ibm.commerce.ras
Class WASLog
java.lang.Object
com.ibm.commerce.ras.WASLog
- public class WASLog
- extends java.lang.Object
Wrapper for the WebSphere log facility. It allows error, warning and informational records to be written to the Websphere Application Server log. To use WASLog, your classpath should contain this class, WebSphere's ras.jar and any ResourceBundle properties files or classes that you reference.
In your component's code, you first need to create a logger. The logger should be assigned a name that is unique within the whole of the Commerce product. You need to specify the logger name when making subsequent calls to WASLog from your component.
Use of WASLog requires that you have a ResourceBundle that contains the translated text for all your messages.
Once you have created a logger, you can log error, warning or informational messages to the WebSphere log.
Object[] parms = { "AAA" };
WASLog.error(LOGGER_NAME, "ABCE9999", parms);
Messages will be written both to the WebSphere console as well as to the activity.log file which can be viewed using the WebSphere Log Analyzer tool.
- See Also:
- WASTrace
Field Summary |
static java.lang.String |
COPYRIGHT
IBM copyright notice field. |
Method Summary |
static void |
createLogger(java.lang.String loggerName, java.lang.String componentName)
Creates a logger with the specified name for the specified component. |
static void |
createLogger(java.lang.String loggerName, java.lang.String componentName, java.lang.String resourceBundleName)
Creates a logger with the specified logger name, for the specified component and using the specified resource bundle to obtain translated text for each logged message. |
static void |
error(java.lang.String loggerName, java.lang.String messageKey, java.lang.String className, java.lang.String methodName)
Logs an error message that requires no parameters to the WebSphere message log. |
static void |
error(java.lang.String loggerName, java.lang.String messageKey, java.lang.String className, java.lang.String methodName, java.lang.Object parm)
Logs an error message that requires a single parameter to the WebSphere message log. |
static void |
error(java.lang.String loggerName, java.lang.String messageKey, java.lang.String className, java.lang.String methodName, java.lang.Object[] parms)
Logs an error message that requires an arbitrary number of parameters to the WebSphere message log. |
static void |
error(java.lang.String loggerName, java.lang.String messageKey, java.lang.String className, java.lang.String methodName, java.lang.String parm)
Logs an error message that requires a single parameter to the WebSphere message log. |
static void |
errorText(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.String text)
Logs an error message that requires an arbitrary number of parameters to the WebSphere message log. |
static RASMessageLogger |
getMessageLogger(java.lang.String loggerName)
Gets the message logger object with the specified logger name. |
static void |
info(java.lang.String loggerName, java.lang.String messageKey, java.lang.String className, java.lang.String methodName)
Logs an informational message that requires no parameters to the WebSphere message log. |
static void |
info(java.lang.String loggerName, java.lang.String messageKey, java.lang.String className, java.lang.String methodName, java.lang.Object[] parms)
Logs an informational message to the WebSphere message log. |
static void |
info(java.lang.String loggerName, java.lang.String messageKey, java.lang.String className, java.lang.String methodName, java.lang.String parm)
Logs an informational message that requires a single parameter to the WebSphere message log. |
static void |
infoText(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.String text)
Logs an informational message to the WebSphere message log. |
static void |
warn(java.lang.String loggerName, java.lang.String messageKey, java.lang.String className, java.lang.String methodName)
Logs a warning message that requires no parameters to the WebSphere message log. |
static void |
warn(java.lang.String loggerName, java.lang.String messageKey, java.lang.String className, java.lang.String methodName, java.lang.Object[] parms)
Logs a warning message to the WebSphere message log. |
static void |
warn(java.lang.String loggerName, java.lang.String messageKey, java.lang.String className, java.lang.String methodName, java.lang.String parm)
Logs a warning message that requires a single parameter to the WebSphere message log. |
static void |
warnText(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.String text)
Logs a warning message to the WebSphere message log. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
COPYRIGHT
public static final java.lang.String COPYRIGHT
- IBM copyright notice field.
- See Also:
- Constant Field Values
WASLog
public WASLog()
createLogger
public static void createLogger(java.lang.String loggerName,
java.lang.String componentName)
- Creates a logger with the specified name for the specified component. The default WebSphere Commerce resource bundle will be used to obtain translated text for each logged message.
-
- Parameters:
- loggerName - a name to be given the logger than is unique within the Commerce product. If necessary the logger name can be dot-separated to ensure uniqueness (e.g. ShoppingCart, payments.MPF)
- componentName - the name of your component as you want it to be displayed in the WebSphere log. Component names longer than 13 characters may appear truncated in some log viewers.
createLogger
public static void createLogger(java.lang.String loggerName,
java.lang.String componentName,
java.lang.String resourceBundleName)
- Creates a logger with the specified logger name, for the specified component and using the specified resource bundle to obtain translated text for each logged message.
-
- Parameters:
- loggerName - a name to be given the logger than is unique within the Commerce product. If necessary the logger name can be dot-separated to ensure uniqueness (e.g. ShoppingCart, payments.MPF)
- componentName - the name of your component as you want it to be displayed in the WebSphere log. Component names longer than 13 characters may appear truncated in some log viewers.
- resourceBundleName - the fully-qualified name of the ResourceBundle class or properties file than contains the translated descriptions of each logged message.
getMessageLogger
public static final RASMessageLogger getMessageLogger(java.lang.String loggerName)
- Gets the message logger object with the specified logger name. If the logger has not already been created, this method will create it assuming that the component name is the same as the logger name and that the default Commerce ResourceBundle will be used.
-
- Parameters:
- loggerName - the name of the logger
- Returns:
- the logger that can be used to write error, warning and informational messages using the public methods in this class
error
public static final void error(java.lang.String loggerName,
java.lang.String messageKey,
java.lang.String className,
java.lang.String methodName)
- Logs an error message that requires no parameters to the WebSphere message log.
-
- Parameters:
- loggerName - the name that uniquely identifies the message logger
- messageKey - the message key used to find the translated message text from the ResourceBundle assigned by the createLogger() method.
- className - the name of the calling class
- methodName - the name of the calling method
error
public static final void error(java.lang.String loggerName,
java.lang.String messageKey,
java.lang.String className,
java.lang.String methodName,
java.lang.String parm)
- Logs an error message that requires a single parameter to the WebSphere message log.
-
- Parameters:
- loggerName - the name that uniquely identifies the message logger
- messageKey - the message key used to find the translated message text from the ResourceBundle assigned by the createLogger() method.
- className - the name of the calling class
- methodName - the name of the calling method
- parm - the parameter to be inserted into the translated message description.
error
public static final void error(java.lang.String loggerName,
java.lang.String messageKey,
java.lang.String className,
java.lang.String methodName,
java.lang.Object parm)
- Logs an error message that requires a single parameter to the WebSphere message log.
-
- Parameters:
- loggerName - the name that uniquely identifies the message logger
- messageKey - the message key used to find the translated message text from the ResourceBundle assigned by the createLogger() method.
- className - the name of the calling class
- methodName - the name of the calling method
- parm - the parameter to be inserted into the translated message description.
error
public static final void error(java.lang.String loggerName,
java.lang.String messageKey,
java.lang.String className,
java.lang.String methodName,
java.lang.Object[] parms)
- Logs an error message that requires an arbitrary number of parameters to the WebSphere message log.
-
- Parameters:
- loggerName - the name that uniquely identifies the message logger
- messageKey - the message key used to find the translated message text from the ResourceBundle assigned by the createLogger() method.
- className - the name of the calling class
- methodName - the name of the calling method
- parms - the parameters to be inserted into the translated message description. The WebSphere message facility will use the MessageFormat class to create the message description using these parameters.
errorText
public static final void errorText(java.lang.String loggerName,
java.lang.String className,
java.lang.String methodName,
java.lang.String text)
- Logs an error message that requires an arbitrary number of parameters to the WebSphere message log.
-
- Parameters:
- loggerName - the name that uniquely identifies the message logger
- className - the name of the calling class
- methodName - the name of the calling method
- text - the translated message text
warn
public static final void warn(java.lang.String loggerName,
java.lang.String messageKey,
java.lang.String className,
java.lang.String methodName)
- Logs a warning message that requires no parameters to the WebSphere message log.
-
- Parameters:
- loggerName - the name that uniquely identifies the message logger
- messageKey - the message key used to find the translated message text from the ResourceBundle assigned by the createLogger() method.
- className - the name of the calling class
- methodName - the name of the calling method
warn
public static final void warn(java.lang.String loggerName,
java.lang.String messageKey,
java.lang.String className,
java.lang.String methodName,
java.lang.String parm)
- Logs a warning message that requires a single parameter to the WebSphere message log.
-
- Parameters:
- loggerName - the name that uniquely identifies the message logger
- messageKey - the message key used to find the translated message text from the ResourceBundle assigned by the createLogger() method.
- className - the name of the calling class
- methodName - the name of the calling method
- parm - the parameter to be inserted into the translated message description.
warn
public static final void warn(java.lang.String loggerName,
java.lang.String messageKey,
java.lang.String className,
java.lang.String methodName,
java.lang.Object[] parms)
- Logs a warning message to the WebSphere message log.
-
- Parameters:
- loggerName - the name that uniquely identifies the message logger
- messageKey - the message key used to find the translated message text from the ResourceBundle assigned by the createLogger() method.
- className - the name of the calling class
- methodName - the name of the calling method
- parms - the parameters to be inserted into the translated message description. The WebSphere message facility will use the MessageFormat class to create the message description using these parameters.
warnText
public static final void warnText(java.lang.String loggerName,
java.lang.String className,
java.lang.String methodName,
java.lang.String text)
- Logs a warning message to the WebSphere message log.
-
- Parameters:
- loggerName - the name that uniquely identifies the message logger
- className - the name of the calling class
- methodName - the name of the calling method
- text - the translated message text
info
public static final void info(java.lang.String loggerName,
java.lang.String messageKey,
java.lang.String className,
java.lang.String methodName)
- Logs an informational message that requires no parameters to the WebSphere message log.
-
- Parameters:
- loggerName - the name that uniquely identifies the message logger
- messageKey - the message key used to find the translated message text from the ResourceBundle assigned by the createLogger() method.
- className - the name of the calling class
- methodName - the name of the calling method
info
public static final void info(java.lang.String loggerName,
java.lang.String messageKey,
java.lang.String className,
java.lang.String methodName,
java.lang.String parm)
- Logs an informational message that requires a single parameter to the WebSphere message log.
-
- Parameters:
- loggerName - the name that uniquely identifies the message logger
- messageKey - the message key used to find the translated message text from the ResourceBundle assigned by the createLogger() method.
- className - the name of the calling class
- methodName - the name of the calling method
- parm - the parameter to be inserted into the translated message description.
info
public static final void info(java.lang.String loggerName,
java.lang.String messageKey,
java.lang.String className,
java.lang.String methodName,
java.lang.Object[] parms)
- Logs an informational message to the WebSphere message log.
-
- Parameters:
- loggerName - the name that uniquely identifies the message logger
- messageKey - the message key used to find the translated message text from the ResourceBundle assigned by the createLogger() method.
- className - the name of the calling class
- methodName - the name of the calling method
- parms - the parameters to be inserted into the translated message description. The WebSphere message facility will use the MessageFormat class to create the message description using these parameters.
infoText
public static final void infoText(java.lang.String loggerName,
java.lang.String className,
java.lang.String methodName,
java.lang.String text)
- Logs an informational message to the WebSphere message log.
-
- Parameters:
- loggerName - the name that uniquely identifies the message logger
- className - the name of the calling class
- methodName - the name of the calling method
- text - the translated message text
Feedback
(C) Copyright IBM Corporation 1996, 2005. All Rights Reserved.