Configure API Gateway diagnostic trace

By default, API Gateway produces diagnostic trace and debugging information to record details about its runtime execution. For example, this includes services starting or stopping, exceptions, and messages sent through API Gateway. This information can then be used by API Gateway administrators and developers for diagnostics and debugging purposes, and is useful when contacting Axway Support.

You can view and search the contents of API Gateway tracing in the following locations:

  • Logs > Trace view in API Gateway Manager
  • Trace files in the following locations:
    • Admin Node Manager: INSTALL_DIR/trace
    • API Gateway instance: INSTALL_DIR/groups/<group-id>/<instance-id>/trace
    • API Gateway Analytics: INSTALL_DIR/trace
  • A console window for the running server

You can view and search the contents of the API Gateway trace log, domain audit log, and transaction logs in the Logs view in API Gateway Manager.

This topic explains how to configure the trace log only. For more details, see Configure API Gateway logging and events.

For details on how to redact sensitive data from trace files (for example, user passwords or credit card details), see Hide sensitive data in API Gateway Manager. The trace level you set impacts the redaction.

View API Gateway trace files

Each time API Gateway starts up, by default, it writes a trace file to the trace directory in your API Gateway installation (for example, INSTALL_DIR/groups/group-2/server1/trace).

The following example shows an extract from a default API Gateway trace file:

The trace file output takes the following format:

For example, the first line in the above extract is described as follows:

TraceLevel INFO
Timestamp 15/Jun/2012:09:54:01.047
Thread-id [1b10]
TraceMessage Realtime monitoring enabled

Set API Gateway trace levels

The possible trace levels in order of least to most verbose output are as follows:

  • INFO
  • DATA

FATAL is the least verbose and DATA the most verbose trace level. The default trace level is INFO.

Set the trace level

You can set the trace level using the following different approaches:

Startup trace When Admin Node Manager is starting up, it gets its trace level from the tracelevel attribute of the SystemSettings element in /system/conf/nodemanager. You can set the trace level in this file if you need to diagnose boot up issues.
Default Settings trace When API Gateway has started, it reads its trace level from the Default Settings for the API Gateway instance. To set this trace level in the Policy Studio, click the Server Settings node in the Policy Studio tree, then click the General option, then select a Tracing level from the drop-down list.
Dynamic trace You can also change dynamic API Gateway trace levels on-the-fly in API Gateway Manager. For more details, see Configure API Gateway logging and events.

Configure API Gateway trace files

By default, trace files are named servername_timestamp.trc (for example, server1_20130118160212.trc ). You can configure the settings for trace file output in INSTALL_DIR/system/conf/trace.xml, which is included by INSTALL_DIR/system/conf/nodemanager. By default, trace.xml contains the following setting:

This setting means that API Gateway writes Node Manager trace output to nodemanager;onhostname_timestamp .trc (for example, nodemanager;on127.0.0.1_20130118160212.trc) in the trace directory of the API Gateway installation. And, the maximum number of files that the trace directory can contain is 500.

Configure rollover settings

The FileRolloverTrace element can contain the following attributes:


File name used for trace output. Defaults to the tracecomponent attribute read from the SystemSettings element.


Directory where the trace file is written. Defaults to INSTALL_DIR/trace when not specified.

Note If you change the trace directory, you will not be able to view the trace files in API Gateway Manager. For the recommended way to change the trace directory, see the following knowledge base article on Axway Support at

Maximum size of the trace file in bytes before it rolls over to a new file. Defaults to 16777216 (16 MB).


Maximum number of files that the trace directory contains for this filename. Defaults to 500.


Whether the trace file is rolled at the start of the day. Defaults to true.

The following setting shows example attributes:

This setting means that API Gateway writes trace output to myserver.trc in the /mydir/log/trace directory, and rolls the trace files over at the start of each day. The maximum number of files that this directory can contain is 5, and the maximum trace file size is 10 MB.

Write output to syslog

On UNIX/Linux, you can send API Gateway trace output to syslog. In your INSTALL_DIR/system/conf/trace.xml file, add a SyslogTrace element, and specify a facility. For example:

Run trace at DEBUG level

When troubleshooting, it can be useful to set to the trace level to DEBUG for more verbose output. When running a trace at DEBUG level, API Gateway writes the status of every policy and filter that it processes into the trace file.

Debug a filter

The trace output for a specific filter takes the following format:

The status is 0, 1, or 2, depending if the filter failed, succeeded, or aborted. For example, the result of an WS-Security Username Token filter running successfully is as follows:

Debug a policy

The trace output for a policy shows it running with all its contained filters, and takes the following format:

For example, the following extract shows a policy called when running a simple service:

Debug at startup

When running a startup trace with a DEBUG level set in the SystemSettings, API Gateway logs the configuration that it is loading. This can often help to debug any incorrectly configured items at start up, for example:

For details on setting trace levels, and running a startup trace, see Set API Gateway trace levels.

Run trace at DATA level

When the trace level is set to DATA, API Gateway writes the contents of the messages that it receives and sends to the trace file. This enables you to see what messages API Gateway has received and sent (for example, to reassemble a received or sent message).

Note   When the trace level is set to DATA, passwords provided during login are logged in plain text.

Search by thread ID

Every HTTP request handled by API Gateway is processed in its own thread, and threads can be reused when an HTTP transaction is complete. You can see what has happened to a message in API Gateway by following the trace by thread ID. Because multiple messages can be processed by API Gateway at the same time, it is useful to eliminate threads that you are not interested in by searching for items that only match the thread you want.

You can do this using the search feature in the API Gateway Manager Logs view. Enter the thread you wish to search for in the Only show lines with text text box, and click Refresh. Alternatively, you can do this on the command line using vi by specifying the thread ID as a pattern to search for in the trace file. In this example, the thread ID is 145c:

The following example shows the DATA trace when a message is sent by API Gateway (message starts with snd):

The following example shows the DATA trace when a message is received by API Gateway (message starts with rcv):

If you want to see what has been received by API Gateway on this thread, run the following command:

All snd and rcv trace statements start and end with < and > respectively. If you are assembling a message by hand from the DATA trace, remember to remove characters. In addition, the sending and/or receiving of a single message may span multiple trace statements.

Integrate trace output with Apache log4J

Apache log4j is included on API Gateway classpath. This is because some third-party products that API Gateway interoperates with require log4j. The configuration for log4j is found in API Gateway INSTALL_DIR/system/conf directory in the log4j2.xml file.

For example, to specify that the log4j appender sends output to API Gateway trace file, add the following setting to your log4j2.xml file:

Environment variables

These variables override the trace.xml file settings, which enables the logging behavior to be defined at runtime.

  • true = Write trace files to disk
  • false = Do not write trace files to disk
  • true = Output JSON formatted trace to stdout
  • false = Do not output JSON formatted trace to stdout

Related Links