v156 · web api · webrtc
WebRTC Diagnostic Logging API
Three static methods on RTCPeerConnection — startDiagnosticLogging(), stopDiagnosticLogging(), and cancelDiagnosticLogging() — that let a web application start, stop, or cancel the browser’s collection of its own internal WebRTC diagnostic logs. The logs are never exposed to the page: they are stored where the user controls, require explicit user authorization to collect, and the application is never told whether logging actually happened. The page receives only a session UUID it can quote in bug reports.
The API graduated from a Chrome origin trial (the runtime feature record for RTCDiagnosticLogging still carries origin_trial_feature_name: "RTCDiagnosticLogging"; the earlier blink-dev intent thread covers that stage) and is enabled by default on desktop Chrome 156 only — the flag record sets "Android": "" and the ChromeStatus record lists no Android/WebView milestone. No other engine ships it and both vendor positions are unanswered, so the surface may still move. In earlier Chrome versions you can test it with --enable-blink-features=RTCDiagnosticLogging or chrome://flags/#enable-experimental-web-platform-features. Remember the API gives the page no success signal: without user/enterprise authorization (e.g. WebRtcDiagnosticLogCollectionAllowedForOrigins) the calls succeed but nothing is collected.
at a glance
| What it is | “A programmatic interface for web applications to start, stop, and cancel the collection of internal diagnostic logs for WebRTC-related operations performed by the user agent” (webrtc-extensions § Diagnostic logging, quoted 2026-10-25) |
|---|---|
| Why | Local developers debug their app; users hand logs to app developers; organizations collect logs across an internal WebRTC deployment; users may share logs with the browser vendor to fix user-agent bugs — the session UUID identifies the session in a bug report (spec use-case list; explainer) |
| Milestone listing | Chrome 156 — listed under “Enabled by default” in the milestone=156 listing (fetched 2026-10-25; the listing is authoritative for filing) |
| Runtime feature | RTCDiagnosticLogging — status: {"Android": "", "default": "stable"} in runtime_enabled_features.json5 (read at trunk 2026-10-25): stable on desktop, not enabled on Android; it also carried the origin-trial name RTCDiagnosticLogging |
| Enterprise policy | WebRtcDiagnosticLogCollectionAllowedForOrigins — the ChromeStatus summary names this as how admins authorize collection per origin |
| Intents | blink-dev Intent (origin-trial stage) · blink-dev Intent to Ship; tracking bug 481412281 |
| ChromeStatus | 5091582546149376 — WebRTC Diagnostic Logging API |
syntax
Spec IDL, quoted verbatim from webrtc-extensions § Extensions to the RTCPeerConnection Interface (fetched 2026-10-25):
[Exposed=Window]
partial interface RTCPeerConnection {
static DOMString startDiagnosticLogging(optional RTCDiagnosticLoggingOptions options = {});
static undefined stopDiagnosticLogging();
static undefined cancelDiagnosticLogging();
};
dictionary RTCDiagnosticLoggingOptions {
record<DOMString, DOMString> metadata;
};
All three methods are static — they are called on the RTCPeerConnection interface object itself (RTCPeerConnection.startDiagnosticLogging()), not on an instance, and the logging session spans all WebRTC activity in the user agent, not one connection. The session state lives in a per-global internal slot, [[RTCDiagnosticLoggingSessionId]], initialized to null (spec § Internal slots).
reference
RTCPeerConnection.startDiagnosticLogging(options)
Parameters: an optional RTCDiagnosticLoggingOptions dictionary (default {}) whose single member is metadata. Returns: a DOMString — a freshly generated UUID identifying the logging session (the spec says implementations SHOULD use the RFC 4122 § 4.4 random form “to avoid fingerprinting”). Throws:
TypeError— ifmetadatahas more than 5 entries, or any key or value is longer than 100 code units (per the spec’s steps, quoted: “If |metadata|’s map/size is greater than 5, or |metadata| contains any entry whose key or value have a length greater than 100, throw a TypeError”);InvalidStateErrorDOMException— if a session is already running ([[RTCDiagnosticLoggingSessionId]]is not null).
On success the user agent sets the internal slot to the new UUID and, in parallel, starts logging internal WebRTC activity with metadata as context. Whether logging actually happens is subject to user authorization the page can never observe — “the application never knows if diagnostic logging operations succeed or fail” (spec intro).
RTCPeerConnection.stopDiagnosticLogging()
Parameters: none. Returns: undefined. Throws: InvalidStateError DOMException if no session is running. Clears the session slot and, in parallel, stops the logging session; “the user agent MUST NOT log any WebRTC-related activity once the logging session has stopped”. Logged data from the ended session is kept (in the user-controlled store) — contrast cancelDiagnosticLogging().
RTCPeerConnection.cancelDiagnosticLogging()
Parameters: none. Returns: undefined. Throws: InvalidStateError DOMException if no session is running. Clears the session slot, cancels the session in parallel, and — the difference from stop — “the user agent MUST have removed any logged data associated with the canceled logging session” (spec § Methods, quoted 2026-10-25).
RTCDiagnosticLoggingOptions dictionary
One member, metadata, “of type record<DOMString, DOMString>, defaulting to []: a record containing key-value pairs that the application can use to provide context that can be stored in the diagnostic logs” (spec § Dictionary RTCDiagnosticLoggingOptions members, quoted 2026-10-25). Hard limits enforced by startDiagnosticLogging(): at most 5 entries, each key and value at most 100 characters — beyond either, TypeError. The metadata goes into the logs (e.g. an app version or a support-ticket id); it is never read back by the page.
session lifecycle and state transitions
State of [[RTCDiagnosticLoggingSessionId]] | start…() | stop…() | cancel…() |
|---|---|---|---|
null (no session) | sets slot to new UUID, returns it; logging may begin (subject to authorization) | throws InvalidStateError | throws InvalidStateError |
| UUID (session running) | throws InvalidStateError — one session at a time per global | slot → null; logging stops; data kept | slot → null; logging stops; data deleted |
context and exposure
[Exposed=Window] only — the methods are not available in workers (spec IDL). In Chrome 156 the feature is enabled by default on desktop only: the runtime feature record sets "Android": "" (not enabled) against "default": "stable", and the ChromeStatus record lists no Android/WebView milestone. Collection requires explicit, implementation-defined user authorization (“dedicated UI, configuration files, enterprise policies, prompts, or a combination”), which “may be limited to specific origins”; in Chrome the named mechanism is the WebRtcDiagnosticLogCollectionAllowedForOrigins enterprise policy. The authorization status is never exposed to the application.
examples
A support-flow sketch: start logging when the user opts into “report a call-quality problem”, attach context the vendor will see inside the logs, and quote the returned UUID in the ticket. Derived from the spec’s method contracts above (labelled gendn-derived; the API itself gives the page no feedback to display):
let sessionId = null;
function beginCallDiagnostics(ticketId) {
try {
sessionId = RTCPeerConnection.startDiagnosticLogging({
metadata: { // max 5 entries; keys/values ≤ 100 chars
app: "example-conf 4.2.1",
ticket: ticketId,
},
});
// Quote sessionId in the bug report — it identifies the log session
// to whoever the USER chooses to share the logs with.
} catch (e) {
// InvalidStateError: a session is already running.
// TypeError: metadata too large. Nothing else is observable.
}
}
function endCallDiagnostics(keepLogs) {
if (sessionId === null) return;
if (keepLogs) RTCPeerConnection.stopDiagnosticLogging();
else RTCPeerConnection.cancelDiagnosticLogging(); // deletes the data
sessionId = null;
}
Feature-detect before offering the UI — the methods are static, so the check needs no connection:
const supported = "startDiagnosticLogging" in RTCPeerConnection;
No Chrome Platform Showcase demo is built for this feature yet (route /v156/webrtc-diagnostic-logging-api/ HEAD-checked 404, 2026-10-25; a demo would appear under the showcase’s Chrome 156 index). A demo could in any case show only the UUID — the logs themselves are invisible to pages by design.
browser compatibility
Interim table. BCD has no key for any of the three methods (0 matches for “diagnostic” in api/RTCPeerConnection.json, verified 2026-10-25) and webstatus.dev has no web-features entry. Rows compiled from the linked primary sources.
| Browser | Support | Evidence |
|---|---|---|
| Chrome | 156, desktop only; no Android/WebView milestone | ChromeStatus record (desktop 156, android null); flag record ("Android": "", "default": "stable"); Intent to Ship |
| Edge | Not separately reported | No BCD entry to mirror; Chromium-based Edge typically tracks Chromium, but no Edge-specific source exists for this API (2026-10-25) |
| Firefox | No signal | mozilla/standards-positions#1436 (position requested, unanswered as recorded by the ChromeStatus record, 2026-10-25) |
| Safari | No signal | WebKit/standards-positions#699 (same basis) |
security and privacy
- The logs never reach the page. “These diagnostic logs may contain information not exposed to the Web application and therefore, the API cannot expose these logs to the Web application in any way” (spec § Security and Privacy, quoted 2026-10-25). The only page-visible output is the session UUID.
- Everything requires user authorization. Collection, storage, and any upload to the user-agent vendor all “require explicit authorization by the user”, via an implementation-defined mechanism (UI, config, enterprise policy, prompts), possibly origin-limited; the authorization status itself is hidden from the page, so the API “provides no guarantees of success”.
- Fingerprinting: the returned UUID is random (RFC 4122 § 4.4 form recommended by the spec specifically “to avoid fingerprinting”), and because failure is unobservable, a page cannot use the API to probe whether the user has authorized logging.
- Metadata flows one way: the page can push up to 5 short key-value pairs into the logs; nothing flows back.
specifications
| Document | Status |
|---|---|
| WebRTC Extensions — § Diagnostic logging | W3C Editor’s Draft of the webrtc-extensions document (the ChromeStatus record links this section as the spec, maturity “Working draft”) |
| WICG webrtc-diagnostic-logging explainer | Explainer; the ChromeStatus record’s linked proposal document |
see also
- Chrome Platform Status — WebRTC Diagnostic Logging API (API record)
- MDN — RTCPeerConnection (the host interface; MDN has no page for these static methods —
startDiagnosticLogging_staticreturned 404, 2026-10-25) - Chrome Enterprise policy — WebRtcDiagnosticLogCollectionAllowedForOrigins
- blink-dev — earlier Intent (origin-trial stage) · Intent to Ship
- Chrome Platform Showcase — Chrome 156 index (no demo for this feature yet, checked 2026-10-25)