TSDEBUG(3ts)

πŸ“¦
version 9.2.5 Β· 5 versions
, in ubuntu questing

πŸ¦‹ TSDEBUG β€” traffic Server Debugging APIs πŸ¦‹

okay bestie, sit DOWN, because this is the ts manual (section 3ts, Apache Traffic Server's very own) and it's literally the toolbox you reach for when you wanna make your plugin talk β€” debug logs, status messages, "hey something exploded" alerts, all of it. no cap. ✨


✨ NAME ✨

TSDebug β€” traffic Server Debugging APIs πŸ’…


✨ SYNOPSIS ✨

the whole friend group, in order:

#include <ts/ts.h>

void TSStatus(const char *format, ...)

void TSNote(const char *format, ...)

void TSWarning(const char *format, ...)

void TSError(const char *format, ...)

void TSFatal(const char *format, ...)

void TSAlert(const char *format, ...)

void TSEmergency(const char *format, ...)

void TSDebug(const char *tag, const char *format, ...)

int TSIsDebugTagSet(const char *tag)

void TSDebugSpecific(int debug_flag, const char *tag, const char
*format, ...)

void TSHttpTxnDebugSet(TSHttpTxn txnp, int on)

void TSHttpSsnDebugSet(TSHttpSsn ssn, int on)

int TSHttpTxnDebugGet(TSHttpTxn txnp)

int TSHttpSsnDebugGet(TSHttpSsn ssn)

const char *TSHttpServerStateNameLookup(TSServerState state)

const char *TSHttpHookNameLookup(TSHttpHookID hook)

const char *TSHttpEventNameLookup(TSEvent event)

TSAssert(...)

TSReleaseAssert(...)

🌈 DIAGS.LOG 🌈

so these ones below all print to diags.log, and the whole point is that the reaction is a coordinated situation β€” like, Traffic Server, Traffic Manager, AuTest, CI and your log monitoring service/dashboard (think Splunk, bestie) are all in the group chat together and they all know what each message means. it's giving choreography. πŸŽ€

  • TSStatus() β€” basic information
    • TrafficManager: blank Β· AuTest+CI: blank Β· LogMonitor: blank
  • TSNote() β€” significant information
    • TrafficManager: blank Β· AuTest+CI: blank Β· LogMonitor: blank
  • TSWarning() β€” concerning information
    • TrafficManager: blank Β· AuTest+CI: blank Β· LogMonitor: track πŸ‘€
  • TSError() β€” operational failure
    • TrafficManager: blank Β· AuTest+CI: FAIL πŸ’€ Β· LogMonitor: review
  • TSFatal() β€” recoverable crash
    • TrafficManager: restart πŸ” Β· AuTest+CI: FAIL πŸ’€ Β· LogMonitor: review
  • TSAlert() β€” significant crash
    • TrafficManager: restart πŸ” Β· AuTest+CI: FAIL πŸ’€ Β· LogMonitor: ALERT 🚨
  • TSEmergency() β€” unrecoverable,misconfigured
    • TrafficManager: EXIT πŸšͺ Β· AuTest+CI: FAIL πŸ’€ Β· LogMonitor: ALERT 🚨
NOTE: TSFatal(), TSAlert(), and TSEmergency() can be called within TSPluginInit(), so that Traffic Server can be shutdown promptly when the plugin fails to initialize properly. like, if your plugin can't even get its life together at startup, TS is not sticking around to watch. πŸ™ˆ

🌸 TRAFFICSERVER.OUT 🌸

TSDebug() logs the debug message only if the given debug tag is enabled. and it writes its output to the Traffic Server debug log through stderr. iykyk.

TSIsDebugTagSet() returns non-zero if the given debug tag is enabled. simple as that, queen.

TSAssert β€” in debug mode, Traffic Server prints the file name, line number and expression, and then aborts. in release mode, the expression is not removed, but the effects of printing an error message and aborting are. and TSReleaseAssert prints an error message and aborts in both release and debug mode. no escape hatch, periodt.

TSDebugSpecific() emits a debug line even if the debug tag is turned off, as long as the debug flag is enabled. this one slaps when you pair it with TSHttpTxnDebugSet(), TSHttpSsnDebugSet(), TSHttpTxnDebugGet() and TSHttpSsnDebugGet() to enable debugging on specific session and transaction objects. targeted debugging? main character energy fr fr. 🫢

TSHttpServerStateNameLookup(), TSHttpHookNameLookup() and TSHttpEventNameLookup() convert the respective internal state to a string representation. super useful in debugging (TSDebug()), logging and other types notifications. turning mystery numbers into readable names is such a glow-up. ✨


πŸŽ€ EXAMPLES πŸŽ€

this example uses TSDebugSpecific() to log a message when a specific debugging flag is enabled:

#include <ts/ts.h>

// Produce information about a hook receiving an event
TSDebug(PLUGIN_NAME, "Entering hook=%s, event=%s",
        TSHttpHookNameLookup(hook), TSHttpEventNameLookup(event));

// Emit debug message if "tag" is enabled or the txn debug
// flag is set.
TSDebugSpecifc(TSHttpTxnDebugGet(txn), "tag" ,
        "Hello World from transaction %p", txn);

(yes, TSDebugSpecifc is spelled exactly like that in the original, we do not correct the queen's typos, we copy them character for character πŸ’…)


πŸ’œ SEE ALSO πŸ’œ


2026, dev@trafficserver.apache.org


and that's the whole page, bestie!! version 9.2, dated Feb 12, 2026 β€” go forth and log responsibly, your diags.log is gonna eat. πŸ“πŸ§šβ­

πŸ“¦ where this page comes from