xref: /aosp_15_r20/external/webrtc/docs/native-code/logging.md (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1Native logs are often valuable in order to debug issues that can't be easily
2reproduced. Following are instructions for gathering logs on various platforms.
3
4To enable native logs for a native application, you can either:
5
6  * Use a debug build of WebRTC (a build where `NDEBUG` is not defined),
7    which will enable `INFO` logging by default.
8
9  * Call `rtc::LogMessage::LogToDebug(rtc::LS_INFO)` within your application.
10    Or use `LS_VERBOSE` to enable `VERBOSE` logging.
11
12For the location of the log output on different platforms, see below.
13
14#### Android
15
16Logged to Android system log. Can be obtained using:
17
18~~~~ bash
19adb logcat -s "libjingle"
20~~~~
21
22To enable the logging in a non-debug build from Java code, use
23`Logging.enableLogToDebugOutput(Logging.Severity.LS_INFO)`.
24
25#### iOS
26
27Only logged to `stderr` by default. To log to a file, use `RTCFileLogger`.
28
29#### Mac
30
31For debug builds of WebRTC (builds where `NDEBUG` is not defined), logs to
32`stderr`. To do this for release builds as well, set a boolean preference named
33'logToStderr' to `true` for your application. Or, use `RTCFileLogger` to log to
34a file.
35
36#### Windows
37
38Logs to the debugger and `stderr`.
39
40#### Linux/Other Platforms
41
42Logs to `stderr`.
43