java.lang.Object | +--com.ibm.commerce.ras.WASTrace
Wrapper for the WebSphere trace facility. It allows various types of trace records to be written to the Websphere Application Server trace file. To use WASTrace, your classpath should contain this class and WebSphere's ras.jar.
Although this class can be used to write trace records, it cannot be used for specifying trace settings. Users should use the administrators console to set trace settings for particular components and to specify how the trace will be collected by the system. The default application server setting is that all trace is disabled.
No initialization of WASTrace is needed before you begin invoking the trace methods. However, each of these methods requires a logger name that must be unique within the Commerce product. Logger names can be dotted separated to ensure uniqueness (e.g. ShoppingCart, payments.MPF, payments.PDP).
Under WebSphere Application Server, you must use the administrator's console to specify the trace setting as well as the output file for your trace records. The location for the trace file is specified on the trace settings page in both WebSphere Application Server and WebSphere Studio.
Calling applications should condition each trace call with the isTracing() method to ensure optimal performance when tracing is disabled:
if (isTracing(LOGGER_NAME)) WASTrace.debug(LOGGER_NAME,...);
There are three WebSphere trace settings:
event
entryExit
debug
Using the WebSphere Administrator's console you can enable or disable these settings for each Commerce trace logger. You can also choose combinations of these settings.
Calls to the debug()
methods will write to the trace log only
when the debug
trace setting is enabled for the specified
logger.
Calls to the entry
and exit
methods will write to
the trace log only when the entryExit
is enabled for the specified
logger.
Calls to the event()
and exception
methods will
write to the trace log when any trace setting is enabled for the
specified logger.
WASLog
Field Summary | |
---|---|
static java.lang.String |
COPYRIGHT IBM copyright notice field. |
Constructor Summary | |
---|---|
WASTrace() |
Method Summary | |
---|---|
static void |
debug(java.lang.String loggerName, java.lang.String className,
java.lang.String methodName, java.lang.String text) Writes a trace record containing the specified text if debug tracing for the specified logger is enabled. |
static void |
debug(java.lang.String loggerName, java.lang.String className,
java.lang.String methodName, java.lang.String text,
java.lang.Object parm) Writes a trace record containing the specified text and parameters if debug tracing for the specified logger is enabled. |
static void |
debug(java.lang.String loggerName, java.lang.String className,
java.lang.String methodName, java.lang.String text,
java.lang.Object[] parms) Writes a trace record containing the specified text and parameters if debug tracing for the specified logger is enabled. |
static void |
entry(java.lang.String loggerName, java.lang.String className,
java.lang.String methodName) Writes a trace method entry record if entryExit tracing
for the specified logger is enabled. |
static void |
entry(java.lang.String loggerName, java.lang.String className,
java.lang.String methodName, java.lang.Object parm) Writes a trace method entry record if entryExit tracing
for the specified logger is enabled. |
static void |
entry(java.lang.String loggerName, java.lang.String className,
java.lang.String methodName, java.lang.Object[] parms) Writes a trace method entry record if entryExit tracing
for the specified logger is enabled. |
static void |
event(java.lang.String loggerName, java.lang.String className,
java.lang.String methodName, java.lang.String text) Writes a trace record containing the specified text if any tracing is enabled for the specified logger. |
static void |
event(java.lang.String loggerName, java.lang.String className,
java.lang.String methodName, java.lang.String text,
java.lang.Object[] parms) Writes a trace record containing the specified text and parameters if any tracing is enabled for the specified logger. |
static void |
exception(java.lang.String loggerName, java.lang.String className,
java.lang.String methodName, java.lang.Throwable t) Writes a trace record containing the specified exception if any tracing is enabled for the specified logger. |
static void |
exit(java.lang.String loggerName, java.lang.String className,
java.lang.String methodName) Writes a trace method exit record if entryExit tracing
for the specified logger is enabled. |
static void |
exit(java.lang.String loggerName, java.lang.String className,
java.lang.String methodName, java.lang.Object retValue) Writes a trace method exit record containing the specified return value if entryExit tracing for the specified logger is
enabled. |
static RASTraceLogger |
getTraceLogger(java.lang.String loggerName) Gets the RAS trace logger object for the specified component |
static boolean |
isTracing(java.lang.String loggerName) Indicates whether the trace logger is current enabled to trace records. |
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 WASTrace()
Method Detail |
---|
public static final boolean isTracing(java.lang.String loggerName)
if (isTracing(LOGGER_NAME)) WASTrace.debug(LOGGER_NAME,...);This will improve the performance of the system since the arguments of the
debug(...)
method will not be evaluated when tracing is disabled.
loggerName
- the unique name for the trace loggerpublic static void debug(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.String text)
debug
tracing for the specified logger is enabled.
loggerName
- the unique name for the trace loggerclassName
- the name of the calling classmethodName
- the name of the calling methodtext
- the text to be written to the trace
recordpublic static void debug(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.String text, java.lang.Object parm)
debug
tracing for the specified logger is enabled.
loggerName
- the unique name for the trace loggerclassName
- the name of the calling classmethodName
- the name of the calling methodtext
- the text to be written to the trace
recordpublic static void debug(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.String text, java.lang.Object[] parms)
debug
tracing for the specified logger is enabled.
loggerName
- the unique name for the trace loggerclassName
- the name of the calling classmethodName
- the name of the calling methodtext
- the text to be written to the trace
recordpublic static void entry(java.lang.String loggerName, java.lang.String className, java.lang.String methodName)
entryExit
tracing for
the specified logger is enabled.
loggerName
- the unique name for the trace loggerclassName
- the name of the calling classmethodName
- the name of the calling
methodpublic static void entry(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.Object parm)
entryExit
tracing for
the specified logger is enabled.
loggerName
- the unique name for the trace loggerclassName
- the name of the calling classmethodName
- the name of the calling methodparm
- the data to be written to the trace
recordpublic static void entry(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.Object[] parms)
entryExit
tracing for
the specified logger is enabled.
loggerName
- the unique name for the trace loggerclassName
- the name of the calling classmethodName
- the name of the calling methodparms
- the data to be written to the trace
recordpublic static void exit(java.lang.String loggerName, java.lang.String className, java.lang.String methodName)
entryExit
tracing for the
specified logger is enabled.
loggerName
- the unique name for the trace loggerclassName
- the name of the calling classmethodName
- the name of the calling
methodpublic static void exit(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.Object retValue)
entryExit
tracing for the specified logger is enabled.
loggerName
- the unique name for the trace loggerclassName
- the name of the calling classmethodName
- the name of the calling methodretValue
- the value to be returned by the calling
methodpublic static void event(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.String text)
loggerName
- the unique name for the trace loggerclassName
- the name of the calling classmethodName
- the name of the calling methodtext
- the text to be written to the trace
recordpublic static void event(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.String text, java.lang.Object[] parms)
loggerName
- the unique name for the trace loggerclassName
- the name of the calling classmethodName
- the name of the calling methodtext
- the text to be written to the trace
recordpublic static void exception(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.Throwable t)
loggerName
- the unique name for the trace loggerclassName
- the name of the calling classmethodName
- the name of the calling methodt
- the Throwable to report in the trace
logpublic static final RASTraceLogger getTraceLogger(java.lang.String loggerName)
loggerName
- the component that identies the trace logger