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 three log severities:
stdout
stderr
stderr
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:
Logging example once mediasoup is started:
mediasoup mediasoup version 2.X.Y +0ms
mediasoup Server() [options:{ numWorkers: 1, logLevel: 'debug', logTags: [ 'info', 'ice', 'dlts', 'rtp', 'srtp', 'rtcp', 'rbe', 'rtx' ], rtcIPv4: true, rtcIPv6: true, rtcAnnouncedIPv4: undefined, rtcAnnouncedIPv6: undefined, rtcMinPort: 40000, rtcMaxPort: 49999 }] +30ms
mediasoup:Server constructor() [options:{ numWorkers: 1, logLevel: 'debug', logTags: [ 'info', 'ice', 'dlts', 'rtp', 'srtp', 'rtcp', 'rbe', 'rtx' ], rtcIPv4: true, rtcIPv6: true, rtcAnnouncedIPv4: undefined, rtcAnnouncedIPv6: undefined, rtcMinPort: 40000, rtcMaxPort: 49999 }] +3ms
mediasoup:Worker constructor() [id:xgxaspcs#1, parameters:"--logLevel=debug --logTag=info --logTag=ice --logTag=dlts --logTag=rtp --logTag=srtp --logTag=rtcp --logTag=rbe --logTag=rtx --rtcIPv4=true --rtcIPv6=true --rtcMinPort=40000 --rtcMaxPort=49999"] +6ms
mediasoup:Channel constructor() +83ms
mediasoup:mediasoup-worker [id:xgxaspcs#1] Settings::PrintConfiguration() | <configuration> +45ms
mediasoup:mediasoup-worker [id:xgxaspcs#1] Settings::PrintConfiguration() | logLevel : "debug" +0ms
mediasoup:mediasoup-worker [id:xgxaspcs#1] Settings::PrintConfiguration() | logTags : "info,ice,rtp,srtp,rtcp,rbe,rtx" +1ms
mediasoup:mediasoup-worker [id:xgxaspcs#1] Settings::PrintConfiguration() | rtcIPv4 : "192.168.1.34" +0ms
mediasoup:mediasoup-worker [id:xgxaspcs#1] Settings::PrintConfiguration() | rtcIPv6 : (unavailable) +0ms
mediasoup:mediasoup-worker [id:xgxaspcs#1] Settings::PrintConfiguration() | rtcAnnouncedIPv4 : (unset) +1ms
mediasoup:mediasoup-worker [id:xgxaspcs#1] Settings::PrintConfiguration() | rtcAnnouncedIPv6 : (unset) +0ms
mediasoup:mediasoup-worker [id:xgxaspcs#1] Settings::PrintConfiguration() | rtcMinPort : 40000 +0ms
mediasoup:mediasoup-worker [id:xgxaspcs#1] Settings::PrintConfiguration() | rtcMaxPort : 49999 +27ms
mediasoup:mediasoup-worker [id:xgxaspcs#1] Settings::PrintConfiguration() | </configuration> +0ms
mediasoup:mediasoup-worker [id:xgxaspcs#1] main::main() | starting mediasoup-worker [pid:14683] +0ms
mediasoup:mediasoup-worker [id:xgxaspcs#1] main::main() | Little-Endian CPU detected +0ms
mediasoup:mediasoup-worker [id:xgxaspcs#1] main::main() | 64 bits architecture detected +1ms
mediasoup:mediasoup-worker [id:xgxaspcs#1] DepLibUV::PrintVersion() | loaded libuv version: "1.11.0" +0ms
mediasoup:mediasoup-worker [id:xgxaspcs#1] DepOpenSSL::ClassInit() | loaded openssl version: "OpenSSL 1.0.2j 26 Sep 2016" +0ms
mediasoup:mediasoup-worker [id:xgxaspcs#1] DepLibSRTP::ClassInit() | loaded libsrtp version: "libsrtp 2.0.0"
By default logging is turned off. In order to enable it, the DEBUG
environment variable must be set before loading mediasoup and any other Node.js module that also uses the debug module.
Check the debug module documentation for further information regarding how to filter specific log messages based on namespace matching rules.
DEBUG
environment variable before running the Node.js application:$ export DEBUG="mediasoup*"
$ node myapp.js
# or:
$ DEBUG="mediasoup*" node myapp.js
DEBUG
environment variable in Node.js before loading mediasoup:process.env.DEBUG = "mediasoup*"
const mediasoup = require("mediasoup");
$ export DEBUG="*" node myapp.js
$ export DEBUG="mediasoup*" node myapp.js
$ export DEBUG="mediasoup:WARN:* mediasoup:ERROR:*" node myapp.js
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.
$ DEBUG="mediasoup:WARN:* mediasoup:ERROR:*" node myapp.js
const mediasoup = require("mediasoup");
const server = mediasoup.Server(
{
logLevel : "warn",
logTags : [ "rtcp" ]
});
$ DEBUG="mediasoup:mediasoup-worker:* *ERROR*" node myapp.js
const mediasoup = require("mediasoup");
const server = mediasoup.Server(
{
logLevel : "debug",
logTags : [ "ice", "dtls" ]
});
server.updateSettings(
{
logLevel : "warn",
logTags : [ "ice", "dtls" ]
});