Enable tracing and logging

One can configure the application server to start in a trace-enabled state by setting the appropriate configuration properties. We can only enable trace for an application client or standalone process at process startup.

In WAS v6.0.x, a logging infrastructure, extending Java Logging, is used. This results in the following changes to the configuration of the logging infrastructure in WAS:

  • Loggers defined in Java logging are equivalent to, and configured in the same way as, trace components introduced in previous versions of WAS. Both are referred to as "components."

  • Both Java logging levels and WAS levels can be used. The following is a complete list of valid levels, ordered in ascending order of severity:

    1. all
    2. finest or debug
    3. finer or entryExit
    4. fine or event
    5. detail
    6. config
    7. info
    8. audit
    9. warning
    10. severe or error
    11. fatal
    12. off

  • Setting the logging and tracing level for a component to all will enable all the logging for that component. Setting the logging and tracing level for a component to off will disable all the logging for that component.

  • We can only configure a component to one level. However, configuring a component to a certain level enables it to perform logging on the configured level and any higher severity level.

  • Several levels have equivalent names: finest is equivalent to debug; finer is equivalent to entryExit; fine is equivalent to event; severe is equivalent to error.

Java Logging does not distinguish between tracing and message logging. However, previous versions of WAS have made a clear distinction between those kind of messages. In WAS v6.0.x, the differences between tracing and message logging are as follows:

  • Tracing messages are messages with lower severity (for example, tracing messages are logged on levels fine, finer, finest, debug, entryExit, or event).

  • Tracing messages are generally not localized.

  • When tracing is enabled, a much higher volume of messages will be produced.

  • Tracing messages provide information for problem determination.

 

Trace and logging strings

In WAS v5.1.1 and earlier, trace strings were used for configuring tracing only. In WAS v6.0.x, the "trace string" becomes a "logging string"; it is used to configure both tracing and message logging.

In WAS v5.1.1 and earlier, the trace service for all WAS components is disabled by default. To request a change to the current state of the trace service, a trace string is passed to the trace service. This trace string encodes the information detailing which level of trace to enable or disable and for which components.

In WAS, the tracing for all components is disabled by default. To change to the current state of the tracing and message logging, a logging string must be constructed and passed to the server. This logging string specifies what level of trace or logging to enable or disable for specific components.

We can type in trace strings (or logging strings), or construct them using the administrative console. Trace and logging strings must conform to a specific grammar.

For WAS v5.1.1 and earlier, the specification of this grammar is as follows

TRACESTRING=COMPONENT_TRACE_STRING[:COMPONENT_TRACE_STRING]* 
COMPONENT_TRACE_STRING=COMPONENT_NAME=LEVEL=STATE[,LEVEL=STATE]* 
LEVEL = all | entryExit | debug | event 
STATE = enabled | disabled 
COMPONENT_NAME = COMPONENT | GROUP

For WAS v6.0.x, the previous grammar is supported. However a new grammar has been added to better represent the underlying infrastructure

LOGGINGSTRING=COMPONENT_LOGGING_STRING[:COMPONENT_LOGGING_STRING]* 
COMPONENT_TRACE_STRING=COMPONENT_NAME=LEVEL
LEVEL = all | (finest | debug) | (finer | entryExit) | (fine | event ) 
| detail | config | info | audit | warning | (severe | error) | fatal | off
COMPONENT_NAME = COMPONENT | GROUP

The COMPONENT_NAME is the name of a component or group registered with the trace service logging infrastructure. Typically, WAS components register using a fully qualified Java class name, for example com.ibm.servlet.engine.ServletEngine. In addition, use a wildcard character of asterisk (*) to terminate a component name and indicate multiple classes or packages. For example, use a component name of com.ibm.servlet.* to specify all components whose names begin with com.ibm.servlet. Use a wildcard character of asterisk (*) at the end of the component or group name to make the logging string applicable to all components or groups whose names start with specified string. For example, a logging string specifying "com.ibm.servlet.*" as a component name will be applied to all components whose names begin with com.ibm.servlet. When "*" is used by itself in place of the component name, the level the string specifies, will be applied to all components.

Note:

  • In WAS v5.1.1 and earlier, you could set the level to "all=disabled" to disable tracing. This syntax in v6 will result in LEVEL=info; tracing will be disabled, but logging will be enabled.

  • The logging string is processed from left to right. During the processing, part of the logging string might be modified or removed if the levels they configure are being overridden by another part of the logging string.

  • In WAS v6.0.x, "info" is the default level. If the specified component is not present (*=xxx is not found), *=info is always implied. Any component that is not matched by the trace string will have its level set to info.

  • If the logging string does not start with a component logging string specifying a level for all components, using the "*" in place of component name, one will be added, setting the default level for all components.

  • STATE = enabled | disabled is not needed in v6. However, if used, it has the following effect:

    • "enabled" sets the logging for the component specified to the level specified

    • "disabled" sets the logging for the component specified to one level above the level specified. The following examples illustrate the effect that disabling has on the logging level:

      Logging string Resulting logging level Notes
      com.ibm.ejs.ras=debug=disabled com.ibm.ejs.ras=finer debug (v5) = finest (v6)
      com.ibm.ejs.ras=all=disabled com.ibm.ejs.ras=info "all=disabled" will disable tracing; logging is still enabled.
      com.ibm.ejs.ras=fatal=disabled com.ibm.ejs.ras=off  
      com.ibm.ejs.ras=off=disabled com.ibm.ejs.ras=off off is the highest severity

Examples of legal trace strings include:

V5 syntax V6 syntax
com.ibm.ejs.ras.ManagerAdmin=debug=enabled
com.ibm.ejs.ras.ManagerAdmin=finest
com.ibm.ejs.ras.ManagerAdmin=all=enabled,event=disabled
com.ibm.ejs.ras.ManagerAdmin=detail
com.ibm.ejs.ras.*=all=enabled
com.ibm.ejs.ras.*=all
com.ibm.ejs.ras.*=all=enabled:com.ibm.ws.ras=debug=
enabled,entryexit=enabled
com.ibm.ejs.ras.*=all:com.ibm.ws.ras=finer

 

See also


Enabling trace at server startup
Enabling trace on a running server
Enabling trace on client and standalone applications

 

Related Tasks


Manage the application server trace service