java.lang.Object | +--com.ibm.commerce.ras.WASLog
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.
WASTrace
Field Summary | |
---|---|
static java.lang.String |
COPYRIGHT IBM copyright notice field. |
Constructor Summary | |
---|---|
WASLog() |
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 |
Field Detail |
---|
public static final java.lang.String COPYRIGHT
Constructor Detail |
---|
public WASLog()
Method Detail |
---|
public static void createLogger(java.lang.String loggerName, java.lang.String componentName)
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.public static void createLogger(java.lang.String loggerName, java.lang.String componentName, java.lang.String resourceBundleName)
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.public static final RASMessageLogger getMessageLogger(java.lang.String loggerName)
loggerName
- the name of the loggerpublic static final void error(java.lang.String loggerName, java.lang.String messageKey, java.lang.String className, java.lang.String methodName)
loggerName
- the name that uniquely identifies the message
loggermessageKey
- the message key used to find the translated
message text from the ResourceBundle assigned by the
createLogger()
method.className
- the name of the calling classmethodName
- the name of the calling
methodpublic static final void error(java.lang.String loggerName, java.lang.String messageKey, java.lang.String className, java.lang.String methodName, java.lang.String parm)
loggerName
- the name that uniquely identifies the message
loggermessageKey
- the message key used to find the translated
message text from the ResourceBundle assigned by the
createLogger()
method.className
- the name of the calling classmethodName
- the name of the calling methodparm
- the parameter to be inserted into the translated
message description.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)
loggerName
- the name that uniquely identifies the message
loggermessageKey
- the message key used to find the translated
message text from the ResourceBundle assigned by the
createLogger()
method.className
- the name of the calling classmethodName
- the name of the calling methodparm
- the parameter to be inserted into the translated
message description.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)
loggerName
- the name that uniquely identifies the message
loggermessageKey
- the message key used to find the translated
message text from the ResourceBundle assigned by the
createLogger()
method.className
- the name of the calling classmethodName
- the name of the calling methodparms
- 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.public static final void errorText(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.String text)
loggerName
- the name that uniquely identifies the message
loggerclassName
- the name of the calling classmethodName
- the name of the calling methodtext
- the translated message textpublic static final void warn(java.lang.String loggerName, java.lang.String messageKey, java.lang.String className, java.lang.String methodName)
loggerName
- the name that uniquely identifies the message
loggermessageKey
- the message key used to find the translated
message text from the ResourceBundle assigned by the
createLogger()
method.className
- the name of the calling classmethodName
- the name of the calling
methodpublic static final void warn(java.lang.String loggerName, java.lang.String messageKey, java.lang.String className, java.lang.String methodName, java.lang.String parm)
loggerName
- the name that uniquely identifies the message
loggermessageKey
- the message key used to find the translated
message text from the ResourceBundle assigned by the
createLogger()
method.className
- the name of the calling classmethodName
- the name of the calling methodparm
- the parameter to be inserted into the translated
message description.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)
loggerName
- the name that uniquely identifies the message
loggermessageKey
- the message key used to find the translated
message text from the ResourceBundle assigned by the
createLogger()
method.className
- the name of the calling classmethodName
- the name of the calling methodparms
- 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.public static final void warnText(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.String text)
loggerName
- the name that uniquely identifies the message
loggerclassName
- the name of the calling classmethodName
- the name of the calling methodtext
- the translated message textpublic static final void info(java.lang.String loggerName, java.lang.String messageKey, java.lang.String className, java.lang.String methodName)
loggerName
- the name that uniquely identifies the message
loggermessageKey
- the message key used to find the translated
message text from the ResourceBundle assigned by the
createLogger()
method.className
- the name of the calling classmethodName
- the name of the calling
methodpublic static final void info(java.lang.String loggerName, java.lang.String messageKey, java.lang.String className, java.lang.String methodName, java.lang.String parm)
loggerName
- the name that uniquely identifies the message
loggermessageKey
- the message key used to find the translated
message text from the ResourceBundle assigned by the
createLogger()
method.className
- the name of the calling classmethodName
- the name of the calling methodparm
- the parameter to be inserted into the translated
message description.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)
loggerName
- the name that uniquely identifies the message
loggermessageKey
- the message key used to find the translated
message text from the ResourceBundle assigned by the
createLogger()
method.className
- the name of the calling classmethodName
- the name of the calling methodparms
- 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.public static final void infoText(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.String text)
loggerName
- the name that uniquely identifies the message
loggerclassName
- the name of the calling classmethodName
- the name of the calling methodtext
- the translated message text