How to collect client logs

The client logs can help when we want to get more details while debugging an issue. To collect client logs, you can use @azure/logger, which is used by WebJS calling SDK internally.

import { setLogLevel, createClientLogger, AzureLogger } from '@azure/logger';
setLogLevel('info');
let logger = createClientLogger('ACS');
const callClient = new CallClient({ logger });
// app logging
logger.info('....');

@azure/logger supports four different log levels:

  • verbose
  • info
  • warning
  • error

For debugging purposes, info level logging is sufficient in most cases.

In the browser environment, @azure/logger outputs logs to the console by default. You can redirect logs by overriding AzureLogger.log method. For more information, see @azure/logger.

Your app might keep logs in memory if it has a 'download log file' feature. If that is the case, you have to set a limit on the log size. Not setting a limit might cause memory issues on long running calls.

Additionally, if you send logs to a remote service, consider mechanisms such as compression and scheduling. If the client has insufficient bandwidth, sending a large amount of log data in a short period of time can affect call quality.