public class WASTrace
extends java.lang.Object
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 (for example, 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:
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.
Modifier and Type | Field and Description |
---|---|
static java.lang.String | COPYRIGHT
IBM copyright notice field.
|
Constructor and Description |
---|
WASTrace() |
Modifier and Type | Method and Description |
---|---|
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 com.ibm.ras.RASTraceLogger | getTraceLogger(int loggerIndex)
Gets the RAS trace logger object associated with the specified index value.
|
static com.ibm.ras.RASTraceLogger | getTraceLogger(java.lang.String loggerName)
Gets the RAS trace logger object for the specified component
|
static com.ibm.ras.RASTraceLogger | getTraceLogger(java.lang.String loggerName, int loggerIndex)
Gets the RAS trace logger object for the specified component name.
|
static boolean | isTracing(int loggerIndex)
Indicates whether the trace logger is currently enabled to trace records.
|
static boolean | isTracing(java.lang.String loggerName)
Indicates whether the trace logger is currently enabled to trace records.
|
public static final java.lang.String COPYRIGHT
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.
public static final boolean isTracing(int loggerIndex)
if (isTracing(LOGGER_INDEX)) 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.
public static void debug(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.String text)
public static void debug(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.String text, java.lang.Object parm)
public static void debug(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.String text, java.lang.Object[] parms)
public static void entry(java.lang.String loggerName, java.lang.String className, java.lang.String methodName)
public static void entry(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.Object parm)
public static void entry(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.Object[] parms)
public static void exit(java.lang.String loggerName, java.lang.String className, java.lang.String methodName)
public static void exit(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.Object retValue)
public static void event(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.String text)
public static void event(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.String text, java.lang.Object[] parms)
public static void exception(java.lang.String loggerName, java.lang.String className, java.lang.String methodName, java.lang.Throwable t)
public static final com.ibm.ras.RASTraceLogger getTraceLogger(java.lang.String loggerName)
public static final com.ibm.ras.RASTraceLogger getTraceLogger(java.lang.String loggerName, int loggerIndex)
public static final com.ibm.ras.RASTraceLogger getTraceLogger(int loggerIndex)