mediasoup

/ home / Documentation / v3 / mediasoup / Debugging

mediasoup v3 Debugging

Log Levels

mediasoup uses the debug module to log internal information. The JavaScript layer of mediasoup produces its own logs and also collects logs generated by the media worker subprocesses.

There are four log severities:

All the logs generated by mediasoup have a namespace starting with “mediasoup” plus colon, followed by the log severity in upper case plus colon (just if “warn” or “error”), and followed by the internal component name (if any) and the log message.

Log messages generated by media worker subprocesses deserve a special treatment. They are just generated if their severity is equal or higher than the given logLevel, but they are just logged if the value of the DEBUG environment variable matches their namespace.

Logs generated by the media worker subprocesses can have the following namespaces (where NNNNN is the subprocess PID):

Logging example once mediasoup is started:

mediasoup:worker[pid:80653] mediasoup-worker::main() | starting mediasoup-worker process [version:3.0.0-dev] +0ms
mediasoup:worker[pid:80653] mediasoup-worker::main() | little-endian CPU detected +0ms
mediasoup:worker[pid:80653] mediasoup-worker::main() | 64 bits architecture detected +1ms
mediasoup:worker[pid:80653] Settings::PrintConfiguration() | <configuration> +0ms
mediasoup:worker[pid:80653] Settings::PrintConfiguration() |   logLevel            : debug +0ms
mediasoup:worker[pid:80653] Settings::PrintConfiguration() |   logTags             : info,simulcast +0ms
mediasoup:worker[pid:80653] Settings::PrintConfiguration() |   rtcMinPort          : 40000 +0ms
mediasoup:worker[pid:80653] Settings::PrintConfiguration() |   rtcMaxPort          : 49999 +0ms
mediasoup:worker[pid:80653] Settings::PrintConfiguration() | </configuration> +0ms
mediasoup:worker[pid:80653] DepLibUV::PrintVersion() | libuv version: "1.27.0" +0ms
mediasoup:worker[pid:80653] DepOpenSSL::ClassInit() | openssl version: "OpenSSL 1.1.1b  26 Feb 2019" +0ms
mediasoup:worker[pid:80653] DepLibSRTP::ClassInit() | libsrtp version: "libsrtp 2.0.0" +0ms
mediasoup:Worker worker process running [pid:80653] +28ms
mediasoup:Worker createRouter() +1m
mediasoup:Channel[pid:80653] request() [method:worker.createRouter, id:1] +1m
mediasoup:Channel[pid:80653] request succeeded [method:worker.createRouter, id:1] +4ms
mediasoup:Router constructor() +0ms
mediasoup:Channel[pid:80653] request() [method:router.createWebRtcTransport, id:3] +360ms
mediasoup:Channel[pid:80653] request succeeded [method:router.createWebRtcTransport, id:3] +4ms
mediasoup:Transport constructor() +0ms
mediasoup:WebRtcTransport constructor() +0ms
mediasoup:WebRtcTransport setMaxIncomingBitrate() [bitrate:1500000] +4ms
mediasoup:Channel[pid:80653] request() [method:transport.setMaxIncomingBitrate, id:4] +8ms
mediasoup:Channel[pid:80653] request succeeded [method:transport.setMaxIncomingBitrate, id:4] +2ms

Enable Logging

By default logging is turned off. In order to enable it, the DEBUG environment variable must be set before loading mediasoup.

Check the debug module documentation for further information regarding how to filter specific log messages based on namespace matching rules.

Examples

$ export DEBUG="mediasoup*"
$ node myapp.js

# or:

$ DEBUG="mediasoup*" node myapp.js
process.env.DEBUG = "mediasoup*"

const mediasoup = require("mediasoup");
$ DEBUG="*" node myapp.js
$ DEBUG="mediasoup*" node myapp.js
$ DEBUG="mediasoup:WARN:* mediasoup:ERROR:*" node myapp.js

Log Tags

Certain log categories can be enabled in runtime for debugging purposes by using logTags. Those tags just apply to logs generated by media worker subprocesses.

The available list of log tags is the following:

Remember: These logs are just generated if their severity is equal or higher than the given logLevel, but they are just logged if the value of the DEBUG environment variable matches their namespace.

Examples

$ DEBUG="mediasoup:WARN:* mediasoup:ERROR:*" node myapp.js
const mediasoup = require("mediasoup");

const worker = await mediasoup.createWorker(
  {
    logLevel : "warn",
    logTags  : [ "rtcp" ]
  });
$ DEBUG="mediasoup* *ERROR*" node myapp.js
const mediasoup = require("mediasoup");

const worker = await mediasoup.createWorker(
  {
    logLevel : "debug",
    logTags  : [ "ice", "dtls" ]
  });
worker.updateSettings(
  {
    logLevel : "warn",
    logTags  : [ "ice", "dtls" ]
  });