Configuring Logging

The default log level of the Solace JavaScript API and Solace Node.js API  is INFO. If you want to change the log level, use the solace.SolclientFactory.setLogLevel method after calling solace.SolclientFactory.init. The table below lists the supported log levels.

For example:

  • To load the debug variation of the Solace JavaScript API, select the version 10 API profile, and set the log level to TRACE, add the following to the entry point of your application:

    <head>
        <script src="solclient-debug.js"></script>
        <script type="text/javascript">
            var properties = new solace.SolclientFactoryProperties();
            properties.profile = solace.SolclientFactoryProfiles.version10;
            solace.SolclientFactory.init(properties);
            solace.SolclientFactory.setLogLevel(solace.Loglevel.TRACE);
        </script>
    </head>
  • To load the debug variation of the Solace Node.js API, select the version 10 API profile, and set the log level to TRACE, add the following to the entry point of your application:

    var solace = require('solclientjs').debug;
    var properties = new solace.SolclientFactoryProfiles();
    properties.profile = solace.SolclientFactoryProfiles.version10;
    solace.SolclientFactory.init(properties);
    solace.SolclientFactory.setLogLevel(solace.LogLevel.TRACE);

    For more information about behavior profiles, see Initializing and Monitoring APIs.

    For more information about JavaScript and Node.js API variations, see Code and Compile Guidelines.

Supported Log Levels for Solace JavaScript API and Solace Node.js API
Level Description

Fatal

These log levels are reserved for internal errors and should be a cause for investigation. Contact Solace for log events at this level.

Error

Warn

Indicates an application error (for example, invalid parameters passed in or unsupported use of the APIs).

Info

Reserved for unusual events that do not indicate any error, but they are unexpected and might need investigation.

Debug

Typically used for state changes at a high level (for example, connect/disconnect/reconnect). It is also used for unusual events that do not indicate any error, but they are unexpected and might need investigation.

Trace

This log level is voluminous and typically requires us to interpret.

When a log level is set at a given level, all log events with log level less severe than the selected level are filtered out; all log levels equally or more severe are included. For example, if the Error log filter level is selected, only Error and Fatal events are included.