Configuring Logging
This section provides information for using logging for the following Solace Messaging APIs:
- Solace Java RTO API
- Solace Messaging API for C and .NET
- Solace Messaging API for JavaScript and Node.js
For information on logging in the Solace Java API, see Configuring Logging in the Solace Java API.
Solace Java RTO API
The Solace Java RTO API uses Java's default java.util.logging framework. Log levels in the Solace Java RTO API correspond with certain log levels in the Solace C API. The table below shows the mapping of log levels between the APIs.
| Solace Java RTO API Level | Matching Solace 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.
Solace Messaging API for C and .NET
Logging in the Solace C API and Solace .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.
| 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.
| Solace Messaging API | Set Through |
|---|---|
|
Solace C API |
|
|
Solace .NET API |
|
Related Samples
For an example of how to redirect Solace C API and Solace .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.
Solace Messaging API for JavaScript and Node.js
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 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.
| 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.