Logging is a feature that helps in identifying misconfigurations, system failures etc., by logging messages on to the console or syslog server. It is useful for debugging purposes and take appropriate actions based on the messages logged. Logging uses various severity levels to report the condition that has occurred.
Logging OpEN API
This document provides a brief description of the Logging OpEN APIs. The Logging OpEN APIs allow processes outside of the ICOS main process (switchdrvr) access to Logging Management services. It provides the following services:
- Set/Get CLI Command Logging mode.
- Set/Get Console Logging mode.
- Set/Get Console Logging severity level.
- Set/Get Persistent Logging mode.
- Set/Get Persistent Logging severity level.
- Set/Get Syslogging mode.
- Set/Get Syslog port.
- Set/Get/Delete Logging host.
- Set/Get Logging host port and severity level.
- Get maximum number of Logging hosts supported.
- Get maximum length of the logging host address.
All 'Set' operations may affect the Switch behavior and configuration.
Example C Application logging_example
Initialization
In the main function, the sample application initializes the OpEN API RPC service by calling openapiClientRegister() and waits for the RPC service in switchdrvr to start. A Client Handle is returned by openapiClientRegister() which is used while invoking the OpEN APIs. The application then exercises the associated OpEN APIs and logs informational and/or error messages on the console. The example application runs to its completion and exits.
logging_example
logging_example.c is a sample application that demonstrates the use of the Logging OpEN APIs. logging_example is started from the command line and has the following usage syntax:
Usage: logging_example <test#> <arg1> <arg2> ...
- Test 1: Set CLI command logging mode: logging_example 1 <mode>
- Test 2: Get CLI command logging mode: logging_example 2
- Test 3: Set console logging mode: logging_example 3 <mode>
- Test 4: Get console logging mode: logging_example 4
- Test 5: Set console logging severity level: logging_example 5 <severity-level>
- Test 6: Get console logging severity level: logging_example 6
- Test 7: Set persistent logging mode: logging_example 7 <mode>
- Test 8: Get persistent logging mode: logging_example 8
- Test 9: Set persistent logging severity level: logging_example 9 <severity-level>
- Test 10: Get persistent logging severity level: logging_example 10
- Test 11: Set syslog mode: logging_example 11 <mode>
- Test 12: Get syslog mode: logging_example 12
- Test 13: Set syslog port: logging_example 13 <syslog port>
- Test 14: Get syslog port: logging_example 14
- Test 15: Add logging host: logging_example 15 <host address>
- Test 16: Set logging host port: logging_example 16 <host address> <port>
- Test 17: Set logging host severity level: logging_example 17 <host address> <severity-level>
- Test 18: Delete logging host: logging_example 18 <host address>
- Test 19: Show logging host details: logging_example 19
- Test 20: Logging OpEN APIs Sanity: logging_example 20
It exercises all the Logging OpEN APIs with appropriate arguments to manage the Logging component in the ICOS main process (switchdrvr).
Logging CLI/API Cross Reference