Enable Trace Based on Specific Request Content
Use centralized logging to perform a per-request trace analysis and follow the flow of a request through both the ODR and application server tiers.
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
Tasks
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
- List 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.
- 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 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>
- 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)
- List all the rules.
./wsadmin.sh -lang jython -f setReqBasedTracing.py listRuleIDs- 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>
- List of rule IDs to disable. (Required)
For more information on rule expressions, read about HTTP operands.
Use centralized logging to diagnose problems Intelligent Management: HTTP operands