I need a way to write the logs that libcurl produces on stderr, to a file. I find this as a common question, for example in the one below,
http://curl.haxx.se/mail/lib-2002-04/0051.html
but I believe this will write the actual data to file, not the underlying logs.
I need logs such as below, from stderr instead written to a file.
About to connect() to IP.IP.IP.IPa port 22 (#0) Trying IP.IP.IP.IPa ... == Info: connected Connected to IP... ( **...) port 22 (#0)
......etc
Connection #0 to host IP.IP.IP.IPa left intact 34 bytes retrieved Closing connection #0
I also looked into debug.c, http://curl.haxx.se/libcurl/c/debug.html
where it uses the following options,
curl_easy_setopt(curl_handle, CURLOPT_DEBUGFUNCTION, my_trace);
curl_easy_setopt(curl_handle, CURLOPT_DEBUGDATA, &config);
But this again, gives more info regarding the actual data that is transferred. It does not show anything regarding connection, authentication etc.
Please note that I am not using the command line tool.
Edit: It turns out redirection of stderr/stdout is not an acceptable solution for my application since there are multiple threads.