Configuring Logging

This section provides information for configuring logging in the Solace C API.

Logging in the Solace C API does not have any external dependencies. The API supports logging levels in accordance with syslog (RFC 3164). The table below lists the supported log levels.

Supported Log Levels for Solace C 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 in the Solace C API, use solClient_log_setCallback(...).

Related Samples

For an example of how to redirect Solace C API generated logs to stdout, see the RedirectLogs sample.

You can find this example on Solace Developers.