Show TOC

Function documentationTrace Logging Locate this document in the navigation structure

 

You can use this function if you want to activate trace level 2 or 3 for a long period but want to ensure that the trace file does not become too large. This is useful if you are trying to locate a sporadic error. If you are waiting for a particular trace output, you can specify that the trace file should be saved after the pattern you are searching for is found, and that the trace level should then be reset to 1.

In this way, you can easily control the size of the trace files. You can also search the trace file for a particular character string without running the risk of filling up your hard disk if a high trace level is active.

Features

Set Size Limit for Trace Files

To activate trace logging, you have to set the parameter rdisp/TRACE_LOGGING. Here, you also specify the maximum size of the trace file.

If the trace file reaches that size, the content is written to a log file with the name of the trace file and the extension .old. The current trace file is then reset. The rdisp/autothtime parameter is used to define how often the trace file should be checked and, if necessary, reset. The default is 60 seconds.

Trace logging is active for the following trace files:

  • dev_w*work process traces

  • dev_disp dispatcher trace

  • dev_rd gateway trace

  • dev_icm ICM trace

  • dev_ms message server trace

Specify Trace Components

You can use the rdisp/TRACE_SEARCH_LIST parameter to specify a list of trace components that you want taken into account in the automatic trace search.

As a value for this parameter, you can enter a list with the following elements (use a comma or a semicolon to separate elements).

  • ALL: All trace files are searched (default)

  • WP: All work process trace files are searched

  • DISP: The dispatcher trace file is searched

  • GWRD: The gateway trace file is searched

  • ICMAN: The ICM trace file is searched (if available)

  • MS: The message server trace file is searched (if available)

Example Example

rdisp/TRACE_SEARCH_LIST = WP, ICMAN means the following: All work process trace files and the ICM trace file are included in the search.

End of the example.
Search Trace Files for a Pattern

The rdisp/TRACE_PATTERN_<x> parameter is used to search the trace files for a specific pattern. When the file size specified in rdisp/TRACE_LOGGING is exceeded, the file is then searched for this pattern. If the pattern is found, the trace level is reset to 1 for all active components.

You can also use wildcards (* for any character string, ? for a single character) in the pattern. Use the backslash (\) to ensure that special characters are treated as ordinary characters.

Note Note

Note that wildcards reduce system performance, especially if they are in the middle of a pattern.

End of the note.

For the sake of readability, the search patterns in the following examples are enclosed in inverted commas. When specifying your own search terms in RZ11 or in the profiles, however, enter them without inverted commas.

Example Example

The pattern "word1 * word?" is found in the line "one example with word1 and word2" but not in the line "one example with word1 and word".

The pattern "10 \* 10 =" is found in the line "Multiplication: 10 * 10 = 100 but not in the line "Addition: 10 + 10 = 20".

End of the example.

Caution Caution

You cannot join several search patterns logically. For example, you cannot search for pattern 1 and pattern 2.

End of the caution.
System-Wide Trace Logging

If you want to search for a pattern on all the servers of a system and when this is found end the trace logging on all the servers (that is, reset the trace level to 1), you use the addition global=on. If global=off or is not set at all, logging is only switched off on the server where the pattern was found.

Note Note

The addition global=on or global=off only has an effect if, at the same time as rdisp/TRACE_LOGGING, rdisp/TRACE_PATTERN_0 is also set.

End of the note.
Standalone Message Server

The message server itself searches only for the string in dev_ms if ms/standalone = 1 is set. Otherwise the search is performed by a work process of the same instance as that with which the message server was started.

If the message server does the search itself, the search is started in a separate thread, which means that if the file is large, the normal processing of requests is not hindered.

Activities

Proceed as follows.

  1. Activate trace logging by setting the rdisp/TRACE_LOGGING parameter to ON. Also specify the size at which, once reached, the trace file is logged and the trace level is reset to 1.

    You can dynamically change this parameter in transaction RZ11.

    The parameter values have the following syntax:

    Syntax Syntax

    1. rdisp/TRACE_LOGGING = on, <n> [k | m] , [global=on | off] | off
    End of the code.

    The first part specifies that logging is active. The value here can be either ON or OFF. If logging is active, you can specify the file size in the second part. The addition global=on or global=off is effective only if rdisp/TRACE_PATTERN_0 has been set for the pattern search (cf. system-wide trace logging).

    Example Example

    • rdisp/TRACE_LOGGING = off: No trace logging

    • rdisp/TRACE_LOGGING = on, 1000: Trace is logged if the trace file contains more than 1000 bytes

    • rdisp/TRACE_LOGGING = on, 20 k: Trace is logged if the trace file contains more than 20 KB

    • rdisp/TRACE_LOGGING = on, 30 m, global=on: Trace is logged, trace file is limited to 30 MB. If the searched pattern is found in a trace file, trace logging is deactivated on all servers.

    End of the example.
  2. Use the rdisp/TRACE_PATTERN_0 parameter specify a search pattern for automatically switching off the SAP trace. This parameter only has an effect if trace logging is activated using rdisp/TRACE_LOGGING. In this case, the trace files are searched for the search pattern before being automatically reset. If the pattern is found, trace logging is deactivated and the trace level is reset to 1. The following trace files are included in the search:

    dev_w* work process traces

    dev_disp dispatcher trace

    dev_rd gateway trace

    dev_icm ICM trace

    dev_ms message server trace

    The search pattern can contain the special character * for any character string and ? for any character. You can use the rdisp/TRACE_PATTERN_1 and rdisp/TRACE_PATTERN_2 parameters to define additional search patterns. All search patterns use the or operator; in other words, if one of the patterns is found, the trace level is reset.

Example

Click here for an example of trace logging in use.