Configuring Logging

This section provides information for using logging for the following PubSub+ Messaging APIs:

For information on logging in the PubSub+ Java API, see Configuring Logging in the PubSub+ Java API.

PubSub+ Java RTO API

The PubSub+ Java RTO API uses Java's default java.util.logging framework. Log levels in the PubSub+ Java RTO API correspond with certain log levels in the PubSub+ C API. The table below shows the mapping of log levels between the APIs.

Supported Log Levels for PubSub+ Java RTO API

PubSub+ Java RTO API Level Matching PubSub+ C API Level Description

Severe

Critical

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

Error

Warning

Warn

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

Info

Notice

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

Fine

Info

Typically used for state changes at a high level (for example, connect/disconnect/reconnect).

Finest

Debug

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 Warning log filter level is selected, only Warning and Severe events are included. In contrast, if the Fine log filter level is selected, Fine, Info, Warning, and Severe events are included, and the Finest level is filtered out.

PubSub+ Messaging API for C and .NET

Logging in the PubSub+ C API and PubSub+ .NET API does not have any external dependencies. These APIs support logging levels in accordance with syslog (RFC 3164). The table below lists the supported log levels.

Supported Log Levels for PubSub+ C API and PubSub+ .NET API

Level Description

Critical

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).

Notice

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

Info

Typically used for state changes at a high level (for example, connect/disconnect/reconnect).

Debug

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 Critical events are included. In contrast, if Info log filter level is selected, Info, Notice, Warn, Error and Critical events are included, and the Debug level is filtered out.

Logging levels and a log event callback or delegate can be set when the APIs are initialized.

To Set Up a Log Callback or Delegate

PubSub+ Messaging API Set Through

PubSub+ C API

solClient_log_setCallback(...)

PubSub+ .NET API

ContextFactoryProperties.LogDelegate

Related Samples

For an example of how to redirect PubSub+ C API and PubSub+ .NET API generated logs to stdout, see the RedirectLogs sample.

You can see the example in the Logging.java sample file that demonstrates how to work with logs generated by the API.

You can find these examples on Solace Developers.

PubSub+ Messaging API for JavaScript and Node.js

The default log level of the PubSub+ JavaScript API and PubSub+ 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 PubSub+ 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 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 JavaScript and Node.js 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 PubSub+ JavaScript API and PubSub+ 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.