Configuring Logging

This section provides information for using messaging API logging, and includes the following APIs:

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

JCSMP

JCSMP uses Apache Commons Logging to support different logging frameworks, such as log4j or java.util.logging for the application’s logging framework.

To turn on logging of Kerberos events, set the Java system property to the following: -Dsun.security.krb5.debug=true.

Supported Log Levels for Java

Level Description

Fatal

These log levels are reserved for internal errors and should be a cause for investigation. Contact Solace customer support 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

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.

Debug

This log level is voluminous and typically requires Solace customer support to interpret.

Trace

Not used.

When a log level is set at a given level, all log events with log levels 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.

Java designers should be familiar with such logging frameworks because they are an established standard for Java-based systems. However, you should consider the following points:

  • When using log4j, the directory in which the log4j.properties file and log4j.jar file exist is on the classpath.
  • When using log4j, including the log4j.jar library file without log4j.properties in the classpath negatively impacts performance.

Java RTO API

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

Supported Log Levels for Java RTO

Java RTO Level Matching C Level Description

Severe

Critical

These log levels are reserved for internal errors and should be a cause for investigation. Contact Solace customer support 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 Solace customer support 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.

C and .NET APIs

Logging in the C and .NET APIs 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 C and .NET

Level Description

Critical

These log levels are reserved for internal errors and should be a cause for investigation. Contact Solace customer support 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 Solace customer support 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

C

solClient_log_setCallback(...)

.NET

ContextFactoryProperties.LogDelegate

Related Samples

For an example of how to redirect C API and .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.

JavaScript and Node.js APIs

The default log level of the JavaScript and Node.js APIs 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 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 JavaScript and Node.js
Level Description

Fatal

These log levels are reserved for internal errors and should be a cause for investigation. Contact Solace customer support 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 Solace customer support 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.