Default logger, enabling and disabling
By default, WebSDK functions log will be displayed to the browser console with INFO level
Since build 0.5.28.2753.131 (the source code is available on GitHub by tag 05cb5bd), logging can be fully disabled while API initializing
Flashphoner.init({flashMediaProviderSwfLocation: '../../../../media-provider.swf', logger: null});
or in an application code by the following function call
Flashphoner.getLogger().setEnableLogs(false);
Then, logging can be enabled again if necessary
Flashphoner.getLogger().setEnableLogs(true);
Log level adjusting
Logging level can be changed while API initializing
Flashphoner.init({flashMediaProviderSwfLocation: '../../../../media-provider.swf', logger: {severity: "WARN"}});
or in an application code by the following function call
Flashphoner.getLogger().setLevel("WARN");
The following logging levels are supported:
Level text constant | Description |
---|
ERROR | Errors only |
WARN | Errors and warnings |
INFO | WebSDK functions normal log (default) |
DEBUG | Debug info |
TRACE | Execution trace |
Push logs to the server
By default, client logs will no be pushed to the server. This feature can be enabled if necessary while API initializing
Flashphoner.init({flashMediaProviderSwfLocation: '../../../../media-provider.swf', logger: {push: true}});
or in an application code by the following function call
Flashphoner.getLogger().setPushLogs(true);
In this case client logs will be sent to WCS server via Websocket connection and will be passed to backend using REST hook /pushLogs:
10:16:03,335 INFO RestClient - API-ASYNC-pool-12-thread-5 SEND REST OBJECT ==>
URL:http://localhost:8081/apps/EchoApp/pushLogs
OBJECT:
{
"nodeId" : "vdUfWbDQUa9TIFfYSwGmXhDs3zp1vH4p@192.168.0.111",
"appKey" : "defaultApp",
"sessionId" : "/192.168.0.100:50627/192.168.0.111:8443-966a2082-8033-4982-9bcb-fecc1bd46169",
"logs" : "10:15:55 INFO webrtc - \"Initialized\"\n",
"origin" : "https://test.flashphoner.com:8888"
}
On Websocket connection closing, client logs will be written to server logs:
10:16:09,144 INFO WCS4Handler - DISCONNECT-CLIENT-pool-5-thread-7
[-- BEGIN CLIENT LOG --]
CONF: ClientConfig{rtspMedia=falsertmpAgent=false, wsTunnel=false, login='rcmv5ls2g9fjno4rf09h7ct0d4', authenticationName='null', password='null', domain='null', outboundProxy='null', port=0, visibleName='null', regRequired=false, applicationName='null', swfUrl='null', qValue='null', pAssociatedUri='null', contactParams='null', authDate=Tue Dec 17 10:16:00 NOVT 2019, authToken='/192.168.0.100:50627/192.168.0.111:8443-966a2082-8033-4982-9bcb-fecc1bd46169', logsFolderName='null', clientVersion='0.5.28', clientOSVersion='5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36', clientBrowserVersion='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36', wsTunnelPacketization2='false', custom='{origin=https://test.flashphoner.com:8888}'}
IMPL: WSClient{channel=[id: 0x14913825, /192.168.0.100:50627 :> /192.168.0.111:8443], handler=com.flashphoner.server.client.handler.DelegateHandler@488a567e, closed=false, pageUrl='null', countUnansweredPing=0}
LOGS:
10:15:55 INFO webrtc - "Initialized"
10:15:55 INFO core - "Initialized"
10:16:03 DEBUG core - "Publish stream 826f"
10:16:03 INFO webrtc - {"audio":true,"video":{"width":320,"height":240,"frameRate":{"ideal":30}}}
10:15:55 INFO websocket - "Initialized"
10:16:04 INFO webrtc - "FOUND WEBRTC CACHED INSTANCE, id 8f70ebf0-207b-11ea-a503-b90a7846c4dd-LOCAL_CACHED_VIDEO"
10:16:04 DEBUG webrtc - "unknown device audioinput id communications"
10:16:04 DEBUG core - "Offer SDP:\nv=0\r\no=- 711383983964074476 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0 1\r\na=msid-semantic: WMS slBjksaRGOgqj5VSdPsLLMGDVWxrCDnGTXhK\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 110 112 113 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:Od1r\r\na=ice-pwd:6pgmvqFhvU6kZAvh6YyUm3x0\r\na=ice-options:trickle\r\na=fingerprint:sha-256 C6:73:08:03:00:33:DE:19:19:F3:A2:E6:E6:82:57:8A:7C:C4:F2:E5:40:6A:B8:7D:17:BD:0F:0C:1F:1B:5C:7D\r\na=setup:actpass\r\na=mid:0\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=extmap:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\na=extmap:6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id\r\na=sendonly\r\na=msid:slBjksaRGOgqj5VSdPsLLMGDVWxrCDnGTXhK 25d893b6-58b4-4000-b8ca-9848f134919d\r\na=rtcp-mux\r\na=rtpmap:111 opus/48000/2\r\na=rtcp-fb:111 transport-cc\r\na=fmtp:111 minptime=10;useinbandfec=1\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:104 ISAC/32000\r\na=rtpmap:9 G722/8000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:106 CN/32000\r\na=rtpmap:105 CN/16000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:110 telephone-event/48000\r\na=rtpmap:112 telephone-event/32000\r\na=rtpmap:113 telephone-event/16000\r\na=rtpmap:126 telephone-event/8000\r\na=ssrc:2608046740 cname:5enl89cAwo3Zr4+N\r\na=ssrc:2608046740 msid:slBjksaRGOgqj5VSdPsLLMGDVWxrCDnGTXhK 25d893b6-58b4-4000-b8ca-9848f134919d\r\na=ssrc:2608046740 mslabel:slBjksaRGOgqj5VSdPsLLMGDVWxrCDnGTXhK\r\na=ssrc:2608046740 label:25d893b6-58b4-4000-b8ca-9848f134919d\r\nm=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 102 122 127 121 125 107 108 109 124 120 123 119 114 115 116\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:Od1r\r\na=ice-pwd:6pgmvqFhvU6kZAvh6YyUm3x0\r\na=ice-options:trickle\r\na=fingerprint:sha-256 C6:73:08:03:00:33:DE:19:19:F3:A2:E6:E6:82:57:8A:7C:C4:F2:E5:40:6A:B8:7D:17:BD:0F:0C:1F:1B:5C:7D\r\na=setup:actpass\r\na=mid:1\r\na=extmap:14 urn:ietf:params:rtp-hdrext:toffset\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:13 urn:3gpp:video-orientation\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:12 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay\r\na=extmap:11 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type\r\na=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing\r\na=extmap:8 http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07\r\na=extmap:9 http://www.webrtc.org/experiments/rtp-hdrext/color-space\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=extmap:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\na=extmap:6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id\r\na=sendonly\r\na=msid:slBjksaRGOgqj5VSdPsLLMGDVWxrCDnGTXhK a5feb98a-4e85-4afe-b562-0d4dacaca904\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=rtpmap:96 VP8/90000\r\na=rtcp-fb:96 goog-remb\r\na=rtcp-fb:96 transport-cc\r\na=rtcp-fb:96 ccm fir\r\na=rtcp-fb:96 nack\r\na=rtcp-fb:96 nack pli\r\na=rtpmap:97 rtx/90000\r\na=fmtp:97 apt=96\r\na=rtpmap:98 VP9/90000\r\na=rtcp-fb:98 goog-remb\r\na=rtcp-fb:98 transport-cc\r\na=rtcp-fb:98 ccm fir\r\na=rtcp-fb:98 nack\r\na=rtcp-fb:98 nack pli\r\na=fmtp:98 profile-id=0\r\na=rtpmap:99 rtx/90000\r\na=fmtp:99 apt=98\r\na=rtpmap:100 VP9/90000\r\na=rtcp-fb:100 goog-remb\r\na=rtcp-fb:100 transport-cc\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 nack pli\r\na=fmtp:100 profile-id=2\r\na=rtpmap:101 rtx/90000\r\na=fmtp:101 apt=100\r\na=rtpmap:102 H264/90000\r\na=rtcp-fb:102 goog-remb\r\na=rtcp-fb:102 transport-cc\r\na=rtcp-fb:102 ccm fir\r\na=rtcp-fb:102 nack\r\na=rtcp-fb:102 nack pli\r\na=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f\r\na=rtpmap:122 rtx/90000\r\na=fmtp:122 apt=102\r\na=rtpmap:127 H264/90000\r\na=rtcp-fb:127 goog-remb\r\na=rtcp-fb:127 transport-cc\r\na=rtcp-fb:127 ccm fir\r\na=rtcp-fb:127 nack\r\na=rtcp-fb:127 nack pli\r\na=fmtp:127 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f\r\na=rtpmap:121 rtx/90000\r\na=fmtp:121 apt=127\r\na=rtpmap:125 H264/90000\r\na=rtcp-fb:125 goog-remb\r\na=rtcp-fb:125 transport-cc\r\na=rtcp-fb:125 ccm fir\r\na=rtcp-fb:125 nack\r\na=rtcp-fb:125 nack pli\r\na=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f\r\na=rtpmap:107 rtx/90000\r\na=fmtp:107 apt=125\r\na=rtpmap:108 H264/90000\r\na=rtcp-fb:108 goog-remb\r\na=rtcp-fb:108 transport-cc\r\na=rtcp-fb:108 ccm fir\r\na=rtcp-fb:108 nack\r\na=rtcp-fb:108 nack pli\r\na=fmtp:108 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f\r\na=rtpmap:109 rtx/90000\r\na=fmtp:109 apt=108\r\na=rtpmap:124 H264/90000\r\na=rtcp-fb:124 goog-remb\r\na=rtcp-fb:124 transport-cc\r\na=rtcp-fb:124 ccm fir\r\na=rtcp-fb:124 nack\r\na=rtcp-fb:124 nack pli\r\na=fmtp:124 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d0032\r\na=rtpmap:120 rtx/90000\r\na=fmtp:120 apt=124\r\na=rtpmap:123 H264/90000\r\na=rtcp-fb:123 goog-remb\r\na=rtcp-fb:123 transport-cc\r\na=rtcp-fb:123 ccm fir\r\na=rtcp-fb:123 nack\r\na=rtcp-fb:123 nack pli\r\na=fmtp:123 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640032\r\na=rtpmap:119 rtx/90000\r\na=fmtp:119 apt=123\r\na=rtpmap:114 red/90000\r\na=rtpmap:115 rtx/90000\r\na=fmtp:115 apt=114\r\na=rtpmap:116 ulpfec/90000\r\na=ssrc-group:FID 473001812 3694826197\r\na=ssrc:473001812 cname:5enl89cAwo3Zr4+N\r\na=ssrc:473001812 msid:slBjksaRGOgqj5VSdPsLLMGDVWxrCDnGTXhK a5feb98a-4e85-4afe-b562-0d4dacaca904\r\na=ssrc:473001812 mslabel:slBjksaRGOgqj5VSdPsLLMGDVWxrCDnGTXhK\r\na=ssrc:473001812 label:a5feb98a-4e85-4afe-b562-0d4dacaca904\r\na=ssrc:3694826197 cname:5enl89cAwo3Zr4+N\r\na=ssrc:3694826197 msid:slBjksaRGOgqj5VSdPsLLMGDVWxrCDnGTXhK a5feb98a-4e85-4afe-b562-0d4dacaca904\r\na=ssrc:3694826197 mslabel:slBjksaRGOgqj5VSdPsLLMGDVWxrCDnGTXhK\r\na=ssrc:3694826197 label:a5feb98a-4e85-4afe-b562-0d4dacaca904\r\n"
10:16:04 DEBUG webrtc - "unknown device audiooutput id default"
10:16:04 DEBUG webrtc - "unknown device audiooutput id 6e3a02b2757fa1a862fe0c38cc9901fdae1a96ffc171489d13714e0530cbf12f"
10:16:04 DEBUG webrtc - "unknown device audiooutput id 888ce197e3dbe33d68c51c46e37dfee6534cd98523ef7c0c8aa6a80cb71288d3"
10:16:04 DEBUG webrtc - "unknown device audiooutput id communications"
10:16:04 DEBUG webrtc - "Added icecandidate: candidate:2407917592 1 udp 2122260223 172.16.0.142 50895 typ host generation 0 ufrag Od1r network-id 1"
10:16:04 DEBUG webrtc - "Added icecandidate: candidate:2131708102 1 udp 2122194687 192.168.0.100 50896 typ host generation 0 ufrag Od1r network-id 2"
10:16:04 DEBUG webrtc - "Added icecandidate: candidate:2407917592 1 udp 2122260223 172.16.0.142 50898 typ host generation 0 ufrag Od1r network-id 1"
10:16:04 DEBUG webrtc - "Added icecandidate: candidate:3119442946 1 udp 2122129151 169.254.219.216 50897 typ host generation 0 ufrag Od1r network-id 3"
10:16:04 DEBUG webrtc - "Added icecandidate: candidate:3119442946 1 udp 2122129151 169.254.219.216 50900 typ host generation 0 ufrag Od1r network-id 3"
10:16:04 DEBUG webrtc - "Added icecandidate: candidate:2131708102 1 udp 2122194687 192.168.0.100 50899 typ host generation 0 ufrag Od1r network-id 2"
10:16:04 DEBUG webrtc - "unknown device audiooutput id default"
10:16:04 DEBUG webrtc - "unknown device audioinput id communications"
10:16:04 DEBUG webrtc - "unknown device audiooutput id communications"
10:16:04 DEBUG webrtc - "unknown device audiooutput id 888ce197e3dbe33d68c51c46e37dfee6534cd98523ef7c0c8aa6a80cb71288d3"
10:16:04 DEBUG webrtc - "unknown device audiooutput id 6e3a02b2757fa1a862fe0c38cc9901fdae1a96ffc171489d13714e0530cbf12f"
10:16:04 DEBUG webrtc - "setRemoteSDP:"
10:16:04 DEBUG webrtc - "v=0\r\no=Flashphoner 0 1576552564626 IN IP4 192.168.0.111\r\ns=Flashphoner/1.0\r\nc=IN IP4 192.168.0.111\r\nt=0 0\r\nm=audio 31038 RTP/SAVPF 111 8 9\r\nc=IN IP4 192.168.0.111\r\na=mid:0\r\na=rtpmap:111 opus/48000/2\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:9 G722/8000\r\na=ptime:20\r\na=ice-pwd:63o06qauil0p05ab11s153qs71\r\na=ice-ufrag:8eba9440-207b-11ea-a503-b90a7846c4dd8scpa1ds8tm1sa\r\na=fingerprint:SHA-256 2E:38:3D:F8:CE:9D:74:4A:96:C2:AC:47:92:89:74:15:CF:C7:2C:7A:0B:F3:63:83:6B:0D:57:A1:03:22:C0:45\r\na=candidate:1 1 udp 2130706431 192.168.0.111 31038 typ host\r\na=candidate:1 2 udp 2130706431 192.168.0.111 31038 typ host\r\na=end-of-candidates\r\na=rtcp-mux\r\na=rtcp:31038 IN IP4 192.168.0.111\r\na=recvonly\r\nm=video 31040 RTP/SAVPF 102 125 124 123 127 108 96\r\nc=IN IP4 192.168.0.111\r\na=mid:1\r\na=rtpmap:102 H264/90000\r\na=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f\r\na=rtpmap:125 H264/90000\r\na=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f\r\na=rtpmap:124 H264/90000\r\na=fmtp:124 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d0032\r\na=rtpmap:123 H264/90000\r\na=fmtp:123 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640032\r\na=rtpmap:127 H264/90000\r\na=fmtp:127 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f\r\na=rtpmap:108 H264/90000\r\na=fmtp:108 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f\r\na=rtpmap:96 VP8/90000\r\na=rtcp-fb:* ccm fir\r\na=rtcp-fb:* nack\r\na=rtcp-fb:* nack pli\r\na=rtcp-fb:* goog-remb\r\na=ice-pwd:63o06qauil0p05ab11s153qs71\r\na=ice-ufrag:8eba9440-207b-11ea-a503-b90a7846c4dd8scpa1ds8tm1sa\r\na=fingerprint:SHA-256 2E:38:3D:F8:CE:9D:74:4A:96:C2:AC:47:92:89:74:15:CF:C7:2C:7A:0B:F3:63:83:6B:0D:57:A1:03:22:C0:45\r\na=candidate:1 1 udp 2130706431 192.168.0.111 31040 typ host\r\na=candidate:1 2 udp 2130706431 192.168.0.111 31040 typ host\r\na=end-of-candidates\r\na=rtcp-mux\r\na=rtcp:31040 IN IP4 192.168.0.111\r\na=recvonly\r\n"
10:16:04 DEBUG webrtc - "Added icecandidate: candidate:831304758 1 tcp 1518214911 192.168.0.100 9 typ host tcptype active generation 0 ufrag Od1r network-id 2"
10:16:04 DEBUG webrtc - "Added icecandidate: candidate:4151120114 1 tcp 1518149375 169.254.219.216 9 typ host tcptype active generation 0 ufrag Od1r network-id 3"
10:16:04 DEBUG webrtc - "Added icecandidate: candidate:3238401256 1 tcp 1518280447 172.16.0.142 9 typ host tcptype active generation 0 ufrag Od1r network-id 1"
10:16:04 DEBUG webrtc - "Added icecandidate: candidate:831304758 1 tcp 1518214911 192.168.0.100 9 typ host tcptype active generation 0 ufrag Od1r network-id 2"
10:16:04 DEBUG webrtc - "Added icecandidate: candidate:3238401256 1 tcp 1518280447 172.16.0.142 9 typ host tcptype active generation 0 ufrag Od1r network-id 1"
10:16:04 DEBUG webrtc - "Added icecandidate: candidate:4151120114 1 tcp 1518149375 169.254.219.216 9 typ host tcptype active generation 0 ufrag Od1r network-id 3"
10:16:08 DEBUG core - "Stop stream 826f"
[-- END CLIENT LOG ----]
Using custom logger
Since build 0.5.28.2753.131 (the source code is available on GitHub by tag 05cb5bd), a custom logger can be defined:
var customLogger = {
error: function (text) {
console.log("custom logger: ERROR:",text);
},
warn: function (text) {
console.log("custom logger: WARN:",text);
},
info: function (text) {
console.log("custom logger: INFO:",text);
},
debug: function (text) {
console.log("custom logger: DEBUG:",text);
},
trace: function (text) {
console.log("custom logger: TRACE:",text);
}
};
and can be enabled while API initializing
Flashphoner.init({flashMediaProviderSwfLocation: '../../../../media-provider.swf', logger: {customLogger: customLogger}});
or in an application code by the following function call
Flashphoner.getLogger().setCustomLogger(customLogger);
The custom logger example above will display to the browser console
Logging enabling, disabling, level adjusting and pushing logs to the server work for custom logger as well as for default logger.
A separate logger parameters for session, stream or call
Since WebSDK build 2.0.215 it is possible to set a separate logger parameters not only for application, but also for every session, stream or call. In this case, every object uses its own logger instance. For example, let's create a separate custom loggers for stream publishing and playback in Two Way Streaming application:
1. Define custom loggers for publishing
var publishCustomLogger = {
error: function (text) {
console.log("publish: ERROR:",text);
},
warn: function (text) {
console.log("publish: WARN:",text);
},
info: function (text) {
console.log("publish: INFO:",text);
},
debug: function (text) {
console.log("publish: DEBUG:",text);
},
trace: function (text) {
console.log("publish: TRACE:",text);
}
};
and playback
var playCustomLogger = {
error: function (text) {
console.log("play: ERROR:",text);
},
warn: function (text) {
console.log("play: WARN:",text);
},
info: function (text) {
console.log("play: INFO:",text);
},
debug: function (text) {
console.log("play: DEBUG:",text);
},
trace: function (text) {
console.log("play: TRACE:",text);
}
};
2. Set custom logger option when creating Stream objects for publishing
function publishStream() {
...
session.createStream({
name: streamName,
display: localVideo,
...,
logger: {customLogger: publishCustomLogger}
...
}).publish();
}
and fro playback
function playStream() {
...
session.createStream({
name: streamName,
display: remoteVideo,
logger: {customLogger: playCustomLogger}
...
}).play();
}
3. The following messages will be displayed in browser xconsole while publishing and playing a stream in modified Two Way Streaming example