Repository navigation
Description
Description
Sentry provides method for setting own logging function - sentry_options_set_logger. It is very useful thing and allows to use spdlog library for sentry logging, for example.
But when sentry SDK use cURL as transport in debug logging mode (sentry_options_set_debug(options, 1);), curl does not use function provided via sentry_options_set_logger and makes very noisy and verbose logging.
I found code that cause such behavior in file sentry_transport_curl:
if (state->debug) {
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, stderr);
// CURLOPT_WRITEFUNCTION will `fwrite` by default
} else {
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, swallow_data);
}
It would be nice if curl use logging function provided via sentry_options_set_logger.
When does the problem happen
- During build
- During run-time
- When capturing a hard crash
Environment
I think it can reproduce on any env, just use cURL as transport.
- OS: Linux
- Compiler: Clang 16
- CMake version and config: 3.27.5, SENTRY_BACKEND=crashpad
Steps To Reproduce
Use cURL as transport.
Set debug output mode:
sentry_options_set_debug(options, 1);
Log output
That`s how single log from cURL looks like when application crashes or send error to sentry:
* Trying 23.54.65.344:544...
* Connected to o44554426645443.ingest.sentry.io (23.54.65.344:544) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use h2
* Server certificate:
* subject: C=US; ST=California; L=San Francisco; O=Sentry; CN=ingest.sentry.io
* start date: Jul 25 00:00:00 2023 GMT
* expire date: Aug 24 23:59:59 2024 GMT
* subjectAltName: host "o453454266048.ingest.sentry.io" matched cert's "*.ingest.sentry.io"
* issuer: C=US; O=DigiCert Inc; CN=DigiCert Global G2 TLS RSA SHA256 2020 CA1
* SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x559ff5998200)
> POST /api/45435353454/envelope/ HTTP/2
Host: o4505629035266048.ingest.sentry.io
user-agent: sentry.native/0.6.5
accept: */*
x-sentry-auth:Sentry sentry_key=34534fdfgsdfgefg33gg3g3g3g, sentry_version=7, sentry_client=sentry.native/0.6.5
content-type:application/x-sentry-envelope
content-length:612780
* old SSL session ID is stale, removing
* We are completely uploaded and fine
< HTTP/2 200
< server: nginx
< date: Wed, 20 Sep 2023 14:03:01 GMT
< content-type: application/json
< content-length: 41
< access-control-allow-origin: *
< vary: origin,access-control-request-method,access-control-request-headers
< access-control-expose-headers: x-sentry-error,x-sentry-rate-limits,retry-after
< cross-origin-resource-policy: cross-origin
< x-envoy-upstream-service-time: 1
< strict-transport-security: max-age=31536000; includeSubDomains; preload
< via: 1.1 google
< alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
<
{"id":"gfdg4g4gdfg4gefg4g4g4g4g4g4"}* Connection #0 to host o453454266048.ingest.sentry.io left intact
* Found bundle for host o4505629035266048.ingest.sentry.io: 0x7f925c007ba0 [can multiplex]
* 9 bytes stray data read before trying h2 connection
* Re-using existing connection! (#0) with host o453454266048.ingest.sentry.io
* Connected to o4505629035266048.ingest.sentry.io (34.120.195.249) port 443 (#0)
* Using Stream ID: 3 (easy handle 0x559ff5998200)
> POST /api/2345353454534/envelope/ HTTP/2
Host: o453454266048.ingest.sentry.io
user-agent: sentry.native/0.6.5
accept: */*
x-sentry-auth:Sentry sentry_key=df36356g3g33563453453453, sentry_version=7, sentry_client=sentry.native/0.6.5
content-type:application/x-sentry-envelope
content-length:381
* We are completely uploaded and fine
< HTTP/2 200
< server: nginx
< date: Wed, 20 Sep 2023 14:03:01 GMT
< content-type: application/json
< content-length: 2
< access-control-allow-origin: *
< vary: origin,access-control-request-method,access-control-request-headers
< access-control-expose-headers: x-sentry-error,x-sentry-rate-limits,retry-after
< cross-origin-resource-policy: cross-origin
< x-envoy-upstream-service-time: 1
< strict-transport-security: max-age=31536000; includeSubDomains; preload
< via: 1.1 google
< alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
<
{}* Connection #0 to host o453454266048.ingest.sentry.io left intact
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsNo status
Activity