feat(crashpad): capture client & handler logs#1658
Conversation
|
5a1e927 to
c9d0e55
Compare
Pass `--log-file=<run>/crashpad.log` to crashpad_handler so its log output is written to the run directory alongside other session files. The log is cleaned up with the rest of the `.run` directory on the next `sentry_init`, so it doesn't bloat the database. When `debug` is enabled, also forward the SDK's log level via `--log-level=N` so the handler's log file matches the configured verbosity (otherwise crashpad stays at its built-in default). TRACE and DEBUG map to mini_chromium's `LOG_VERBOSE`, FATAL to `LOG_FATAL`, the rest 1:1. Closes #1468 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drop the default: branch so -Wswitch-enum is satisfied; INFO/WARNING/ ERROR map 1:1 via the cast-initialized default, TRACE/DEBUG collapse to LOG_VERBOSE, FATAL is hardcoded to 4 since SENTRY_LEVEL_FATAL's numeric value (3) collides with mini_chromium's LOG_ERROR_REPORT. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Write the client-side (via logging::InitLogging) and handler-side (via --log-file=) output to <run>/crashpad-client.log and <run>/crashpad-handler.log respectively. On options->debug, also tee client-side logs to stderr. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fe3e4d2 to
bb9e626
Compare
<run>/crashpad.logThe client-side logging::InitLogging was not setting min_log_level, so mini_chromium gated every message below LOG_INFO regardless of options->debug. Lift the level-mapping switch out of the debug-only block and also apply it to settings.min_log_level on the client side. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Bump mini_chromium to the lazy-open + thread-safety fix and drop the file-existence assertions in the capture test — the happy path now leaves no log file behind. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@JoshuaMoelans What do you think about P.S. Neither of them barely logs almost anything at all. They seem to be mostly errors only. |
|
@jpnurmi yeah that sounds good, it's where I would expect these logs to show up (crashpad being a different process, I also don't mind it not going to |
|
@JoshuaMoelans What about the client side that lives in the same process? It can also print useful errors, such as We can either capture client-side errors into STDERR so that it gets mixed in the sentry output (notice one message from Alternatively, we can capture it to C:\Users\jpnurmi\Projects\sentry\sentry-playground>type build\.sentry-native\c6a43bc8-2629-492d-e79c-94cb114aff09.run\crashpad-client.log
[19168:9228:20260420,170017.136:ERROR crashpad_client_win.cc:615] CreateProcess: %1 is not a valid Win32 application. (193)Or, we can combine both so that you get |
Capture crashpad's client- and handler-side log output separately in the run directory:
<run>/crashpad-client.logvialogging::InitLoggingon the client side, and<run>/crashpad-handler.logvia--log-file=on the handler side. Both files are cleaned up with the rest of the.rundirectory on the nextsentry_init, so they don't bloat the database.When
debugis enabled, alsoORinLOG_TO_STDERRon the client side (so crashpad's client-side logs also tee to the app's stderr) and forward the SDK's log level to the handler via--log-level=Nso the handler's log file matches the configured verbosity.TRACEandDEBUGmap tomini_chromium'sLOG_VERBOSE,FATALtoLOG_FATAL, the rest 1:1.Examples:
Close: #1468
See also: