TSDEBUG(3ts)
π¦ 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(), andTSEmergency()can be called withinTSPluginInit(), 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 π
π COPYRIGHT π
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
- ubuntu questing: trafficserver-dev 9.2.5+ds-1ubuntu2.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms