curl_global_trace(3)
π¦ curl_global_trace β log configuration π¦
okay bestie, welcome to the Library Functions Manual corner of the internet, because this is the curl_global_trace(3) page and it is literally the glow-up switch for how chatty libcurl gets π¬β¨
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_global_trace(const char *config);
that's it. one include, one function, one string. slay π
π DESCRIPTION π
so the whole vibe of this function is log configuration β it tunes how libcurl logs stuff so some parts of curl get more verbose and other parts get more silent than the rest. not me giving each subsystem its own volume slider ποΈ
it may be called during the initialization phase of a program. it does not have to be, bestie, no pressure. it can even be called several times, possibly overwriting the settings from previous calls β icon behaviour, honestly.
π¨ calling this function after transfers have been started is undefined. on some platforms/architectures it might take effect, on others not. so likeβ¦ don't. periodt π
this function is thread-safe since libcurl 8.3.0 if curl_version_info(3) has the CURL_VERSION_THREADSAFE feature bit set (which is most platforms π).
if it is not thread-safe, you must not call this function while any other thread in the program (i.e. a thread sharing the same memory) is running. and no, that is not just "no other thread that is using libcurl" β because curl_global_init(3) may call functions of other libraries that are similarly thread-unsafe, it could conflict with any other thread that uses these other libraries. the more you know π§ β¨
if you are initializing libcurl from a Windows DLL, you should not initialize it from DllMain or a static initializer, because Windows holds the loader lock during that time and it could cause a deadlock. genuinely do not do this π
π the config string, explained π
the config string is a list of comma-separated component names. names are case-insensitive and unknown names are ignored (silently, no drama). the special name "all" applies to all components. names may be prefixed with + or - to enable or disable detailed logging for a component. so it's giving "checkboxes but make it a string" π
π important lore: the list of component names is not part of curl's public API. names may be added or disappear in future versions of libcurl. but since unknown names are silently ignored, outdated log configurations don't cause errors when you upgrade libcurl. some names can be expected to be fairly stable though, and they're listed below for easy reference, iykyk π
also, heads up: log configuration applies only to transfers where debug logging is enabled. see CURLOPT_VERBOSE(3) or CURLOPT_DEBUGFUNCTION(3) for how to control that π
πΈ TRACE COMPONENTS πΈ
these are the lil' name tags you can put in your config string:
tcpβ tracing of TCP socket handling: connect, sends, receives πsslβ tracing of SSL/TLS operations, whichever SSL backend is used in your build πftpβ tracing of FTP operations when this protocol is enabled in your build πhttp/2β details about HTTP/2 handling: frames, events, I/O, etc. πͺhttp/3β details about HTTP/3 handling: connect, frames, events, I/O etc. β‘http-proxyβ involved when transfers are tunneled through an HTTP proxy."h1-proxy"or"h2-proxy"are also involved, depending on the HTTP version negotiated with the proxy. π‘οΈ in order to find out all components involved in a transfer, run it with"all"configured. you can then see all names involved in your libcurl version in the trace. detective mode πdnsβ tracing of DNS operations to resolve hostnames and HTTPS records πlib-idsβ adds transfer and connection identifiers as prefix to every call toCURLOPT_DEBUGFUNCTION(3). the format is[n-m]where n is the identifier of the transfer and m is the identifier of the connection. a literalxis used for internal transfers or when no connection is assigned. π·οΈ for example,[5-x]is the prefix for transfer 5 that has no connection. the command line toolcurluses the same format for its--trace-idsoption.lib-idsis intended for libcurl applications that handle multiple transfers but have no own way to identify in trace output which transfer a trace event is connected to. literally built for the multitaskers πdohβ former name for DNS-over-HTTP operations. now an alias fordns. glow-up/rebrand, we love to see it β¨multiβ traces multi operations managing transfers' state changes and sockets poll states πreadβ traces reading of upload data from the application in order to send it to the server π€sshβ tracing of SSH related protocols SCP and SFTP πsslsβ tracing of SSL Session handling, e.g. caching/import/export ποΈsmtpβ tracing of SMTP operations when this protocol is enabled in your build π§timerβ tracing of timers set for transfers β±οΈwriteβ traces writing of download data, received from the server, to the application π₯wsβ tracing of WebSocket operations when this protocol is enabled in your build πΈοΈ
π«Ά TRACE GROUPS π«Ά
besides the specific component names, there are also these group names defined:
allβ all components that your libcurl is built with πnetworkβ all components involved in bare network I/O, including the SSL layer πprotocolβ all components involved in transfer protocols, such as'ftp'and'http/2'π‘proxyβ all components involved in use of proxies π‘οΈ
π PROTOCOLS π
this functionality affects all supported protocols. every single one. no cap π―
π§ EXAMPLE π§
int main(void)
{
/* log details of HTTP/2 and SSL handling */
curl_global_trace("http/2,ssl");
/* log all details, except SSL handling */
curl_global_trace("all,-ssl");
}
below is a trace sample where "http/2" was configured. the trace output of an enabled component appears at the beginning in brackets π
* [HTTP/2] [h2sid=1] cf_send(len=96) submit https://example.com/
...
* [HTTP/2] [h2sid=1] FRAME[HEADERS]
* [HTTP/2] [h2sid=1] 249 header bytes
...
see how the [HTTP/2] tag is just sitting there, main character energy? that's the whole point π
β AVAILABILITY β
added in curl 8.3.0 β so if you're on something ancient, this is your sign to upgrade bestie π«Ά
π RETURN VALUE π
if this function returns non-zero, something went wrong and the configuration may not have any effects, or may only have been applied partially. not the slay we wanted π
π₯ SEE ALSO π₯
and that's the page!! π brought to you by libcurl, dated 2026-10-12, in the Library Functions Manual β go forth and trace responsibly, bestie πΈπ¦
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms