Media/WebRTC/Logging: Difference between revisions

From MozillaWiki
< Media‎ | WebRTC
Jump to navigation Jump to search
(s/MOZ_LOG/MOZ_LOG_MODULES)
(Replacing dead dxr link)
 
(10 intermediate revisions by 3 users not shown)
Line 2: Line 2:


=== Note about NSPR and MOZ_LOG ===
=== Note about NSPR and MOZ_LOG ===
NSPR has been deprecated in favor of [https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Gecko_Logging MOZ_LOG].
NSPR (NSPR_LOG_MODULES) has been deprecated in favor of [https://firefox-source-docs.mozilla.org/xpcom/logging.html MOZ_LOG]. NSPR_LOG_MODULES does not work with the libwebrtc logging, so just use MOZ_LOG.


Environment variable changes:
In Firefox 54 and later, you can use about:networking, and select the Logging option, to change MOZ_LOG/MOZ_LOG_FILE options on the fly -- without restarting the browser.  Also, you can use about:config and set any log option by adding a "logging.xxxxx" variable (right-click -> New), and set it to an integer value of 0-5.
* MOZ_LOG_MODULES now takes the place of NSPR_LOG_MODULES
* MOZ_LOG_FILE now takes the place of NSPR_LOG_FILE
* Avoid having both NSPR_$FOO and MOZ_$FOO set.
* (See <https://groups.google.com/forum/#!topic/mozilla.dev.platform/8AlMO5zv9kc>)


=== ICE/STUN/TURN ===
=== ICE/STUN/TURN ===
Line 14: Line 10:
Set the following environment variables:
Set the following environment variables:
* R_LOG_DESTINATION=stderr
* R_LOG_DESTINATION=stderr
* R_LOG_LEVEL=3 (can be anything between 1 and 9) (See <https://dxr.mozilla.org/mozilla-central/source/media/mtransport/third_party/nrappkit/src/port/win32/include/csi_platform.h> for levels)
* R_LOG_LEVEL=3 (can be anything between 1 and 9) (See <https://searchfox.org/mozilla-central/source/dom/media/webrtc/transport/third_party/nrappkit/src/port/win32/include/csi_platform.h> for levels)
* R_LOG_VERBOSE=1 (if you want to include the module name generating the message)
* R_LOG_VERBOSE=1 (if you want to include the module name generating the message)


=== Signaling (SDP offer/answer handling) ===
=== Signaling (SDP offer/answer handling) ===


This uses the normal Mozilla [https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR/Reference/Logging NSPR logging] infrastructure, which uses a comma-separated list of modules, each one with its indicated [https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR/Reference/NSPR_LOG_MODULES NSPR log level]. For WebRTC, you'll be most interested in
This uses the normal Mozilla [https://firefox-source-docs.mozilla.org/xpcom/logging.html MOZ_LOG] infrastructure, which uses a comma-separated list of modules, each one with its indicated [https://firefox-source-docs.mozilla.org/xpcom/logging.html MOZ log level]. For WebRTC, you'll be most interested in
* MOZ_LOG_MODULES=signaling:5,mtransport:5
* MOZ_LOG=signaling:5,mtransport:5
* MOZ_LOG_FILE=/path/to/nspr.log (if you don't want the default stderr)
* MOZ_LOG_FILE=/path/to/moz.log (if you don't want the default stderr, but be aware that this may not work due to sandboxing)


You can also add ",timestamp" to that list if you want each log message to include timestamps. Other options are available as well, and they are detailed under "Description" on the [https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR/Reference/NSPR_LOG_MODULES NSPR LOG MODULES] MDN page.
You can also add ",timestamp" to that list if you want each log message to include timestamps. Other options are available as well, and they are detailed under "Description" on the [https://firefox-source-docs.mozilla.org/xpcom/logging.html MOZ LOG MODULES] MDN page.


=== getUserMedia ===
=== getUserMedia and others ===
To log getUserMedia stuff, use MOZ_LOG_MODULES=MediaManager:5,GetUserMedia:5.  For frame-by-frame logging, use MediaManager:6
To log getUserMedia stuff, use MOZ_LOG=MediaManager:4,GetUserMedia:4.  For frame-by-frame logging, use MediaManager:5
Camera-specific logging modules: CamerasParent and CamerasChild
DOMMediaStreams: MediaStream
MediaStreamGraph: MediaStreamGraph
GMP (OpenH264): GMP
MediaRecorder: MediaRecorder, MediaEncoder, TrackEncoder, VP8TrackEncoder


=== Media (the GIPS stack: RTP/RTCP) ===
=== Media (the GIPS stack: RTP/RTCP) ===


This also uses the Mozilla logging infrastructure, but it uses a bitmask to select which items are logged, instead of the default log levels. It also logs to a different destination by default.
This also uses the Mozilla logging infrastructure.


* MOZ_LOG_MODULES=webrtc_trace:65535
* MOZ_LOG=webrtc_trace:5
* WEBRTC_TRACE_FILE=/path/to/WebRTC.log (the default is just "WebRTC.log")
** If WEBRTC_TRACE_FILE=nspr, the logs will be inserted into the NSPR logs.  Note this may have a major performance impact.
 
The full list of logging options is found in the TraceLevel enum (see <http://mxr.mozilla.org/mozilla-central/source/media/webrtc/trunk/webrtc/common_types.h#83>).

Latest revision as of 18:05, 28 July 2022

The various pieces of WebRTC do a lot of logging, and these logs can be very helpful to developers when trying to track down problems. This page provides instructions for turning these logging messages on so you can include them in bug reports, etc..

Note about NSPR and MOZ_LOG

NSPR (NSPR_LOG_MODULES) has been deprecated in favor of MOZ_LOG. NSPR_LOG_MODULES does not work with the libwebrtc logging, so just use MOZ_LOG.

In Firefox 54 and later, you can use about:networking, and select the Logging option, to change MOZ_LOG/MOZ_LOG_FILE options on the fly -- without restarting the browser. Also, you can use about:config and set any log option by adding a "logging.xxxxx" variable (right-click -> New), and set it to an integer value of 0-5.

ICE/STUN/TURN

Set the following environment variables:

Signaling (SDP offer/answer handling)

This uses the normal Mozilla MOZ_LOG infrastructure, which uses a comma-separated list of modules, each one with its indicated MOZ log level. For WebRTC, you'll be most interested in

  • MOZ_LOG=signaling:5,mtransport:5
  • MOZ_LOG_FILE=/path/to/moz.log (if you don't want the default stderr, but be aware that this may not work due to sandboxing)

You can also add ",timestamp" to that list if you want each log message to include timestamps. Other options are available as well, and they are detailed under "Description" on the MOZ LOG MODULES MDN page.

getUserMedia and others

To log getUserMedia stuff, use MOZ_LOG=MediaManager:4,GetUserMedia:4. For frame-by-frame logging, use MediaManager:5 Camera-specific logging modules: CamerasParent and CamerasChild DOMMediaStreams: MediaStream MediaStreamGraph: MediaStreamGraph GMP (OpenH264): GMP MediaRecorder: MediaRecorder, MediaEncoder, TrackEncoder, VP8TrackEncoder

Media (the GIPS stack: RTP/RTCP)

This also uses the Mozilla logging infrastructure.

  • MOZ_LOG=webrtc_trace:5