[AIX Solaris HP-UX Linux Windows][z/OS]

Enabling Trace Based on Specific Request Content

You can use centralized logging to easily perform a per-request trace analysis and follow the flow of a request through both the ODR and application server tiers.

About this task

If the routing behavior for a specific type of request is not as expected, it might be valuable to enable specific trace strings during the time when the problem request is being processed. Use request based tracing to dynamically enable tracing based on the content of a request. Request based tracing uses matching rules to specify what trace strings are enabled when requests arrive. If a request arrives that matches a rule, the associated trace string is enabled on the ODR as runtime trace. When the request is sent to the backend application server, the runtime trace string for that backend application server is set to the trace string associated with the rule. When request processing is complete, the runtime trace string is set to *=info

Procedure

Run the setReqBasedTracing.py script to enable or disable request-based tracing rules.
The supported commands are included in the following list:
enableReqBasedTracing
Sets up a request-based tracing rule. A rule consists of an expression and identifier called a rule ID. Optionally, a rule can also contain ODR trace and application server trace strings. Start and end markers are placed in the log files for requests that match one or more rules.

The ODR logs a start marker when a request that matches one or more rules arrives and logs an end marker before the request is dispatched to the backend application server. The ODR also logs a start marker when a response is received from the application server and an end marker after response is sent back to the user. The application server logs a start marker when a matched request arrives from the ODR and an end marker before a response is sent to the ODR. These markers make it possible to find a particular request, or set of requests, and to correlate them with processing of that request on the application server.

listRuleIDs
Lists all the rules. This command will output all the rules that are set on all the ODRs. After an ODR is restarted, the rules must be recreated.
disableReqBasedTracing
Disables a request-based tracing rule.
  1. Enable request-based tracing.
    ./wsadmin.sh -lang jython -f setReqBasedTracing.py enableReqBasedTracing 
    -ruleExpression:<expression> -odrTraceSpec:<trace strings> 
    -appServerTraceSpec:<trace string> -ruleID:<rule ID> 
    where
    -ruleExpression:<expression>
    Specifies an expression that is used to match the requests. (Required)
    -odrTraceSpec:<trace string>
    Specifies an ODR trace string that is set at run time for the requests that match the specified expression. If the parameter is not specified, the trace specification is not dynamically set. (Optional)
    -appServerTraceSpec:<trace string>
    Specifies an application server trace string that is set at run time for the requests that match the specified expression. If the parameter is not specified, the trace specification is not dynamically set. (Optional)
    -ruleID:<rule ID>
    Specifies the ID for the request-based tracing rule. If the parameter is not specified, a rule ID is generated by the script in the form of ruleID-<time stamp>. (Optional)
  2. List all the rules.
    ./wsadmin.sh -lang jython -f setReqBasedTracing.py listRuleIDs 
  3. Disable request-based tracing.
    ./wsadmin.sh -lang jython -f setReqBasedTracing.py disableReqBasedTracing 
    -ruleIDs:<rule ID1>,<rule ID2>...,<ruleIDn>
    where
    -ruleIDs:<rule ID1>,<rule ID2>...,<ruleIDn>
    Specifies a list of rule IDs to disable. (Required)
For more information on rule expressions, read about HTTP operands.