Use the API void TSDebug (const char *tag, const char *format_str, ...) to add traces in your plugin. In this API:

  • tag is the Traffic Server parameter that enables Traffic Server to print out format_str

  • ... is a variable for format_str

Run Traffic Server with the -Ttag option. For example, if the tag is my-plugin, then the debug output goes to traffic.out.See below:

   traffic_server -T"my-plugin"

Set the following variables in records.config (in the Traffic Server config directory):

   proxy.config.diags.debug.enabled INT 1
   proxy.config.diags.debug.tags STRING debug-tag-name

In this case, debug output goes to traffic.out.

Example:

   TSDebug ("my-plugin", "Starting my-plugin at %d\n", the_time);

The statement "Starting my-plugin at <time>" appears whenever you run Traffic Server with the my-plugin tag:

   traffic_server -T"my-plugin"

Other Useful Internal Debug Tags

Traffic Server provides many debug tags for internal debugging purposes. Some of the useful HTTP debug tags are:

  • http_hdrs - traces all incoming and outgoing HTTP headers.

  • http.* - traces all the STTP SM debug statements.

  • sdk - gives some warning concerning API usage.