Debugging and Logging
OcNOS has a comprehensive debugging and logging facility in various protocols and components. This chapter describes how to start and stop debugging and logging. For complete information, see the Network Services Module Command Reference. The protocol debug commands are in the corresponding command references.
About Debugging
In OcNOS, every protocol has debug commands that log parameter-specific information. For example, using the debug ldp nsm command results in OcNOS writing all messages exchanged between LDP and NSM such as interface, bandwidth, and address updates.
You can direct the output from the debug command to:
• Standard output (stdout)
• A file
• The system log (Linux syslog)
OcNOS generates debug output until the no form of the debug command is given.
Start Debugging Output
To start debugging output, turn on the debug options by giving the relevant debug command and enable logging (logging level daemon-name <0-7>). For example:
> enable
# configure terminal
(config)# log file <filename>
(config)# debug <protocol> (parameter)
(config)# logging level <protocol> <0-7>
(config)# exit
Log to Standard Output
To direct debugging output to stdout, give the terminal monitor command.
# terminal monitor
This is a sample output of the debug rsvp events command displayed on the terminal:
# terminal monitor
Dec 2 16:41:49 localhost RSVP[6518]: RSVP: RSVP message sent to 10.10.23.60/32 via interface eth0
Dec 2 16:41:57 localhost RSVP[6518]: RSVP: Received an RSVP message of type RSVP Reservation from 192.168.0.60 via interface eth0
Dec 2 16:41:57 localhost RSVP[6518]: RSVP: Received a RESV message from 10.10.23.60/32
Log to a File
To send debugging output to a file:
1. Use the log file command and specify the path and file name where the information is to be logged.
When logging to a file, you can simultaneously log to stdout by using the terminal monitor command.
2. Use the no form of the command to turn off logging to a file:
(config)# no log file (filename)
Log to the System Log
To send debugging output to syslog:
1. Use the log syslog command:
(config)# log syslog
2. Use the no form of the command to turn off system logging:
(config)# no log syslog
Stop Debugging
To turn off debugging, use the no debug or undebug command. When a protocol is specified with the no debug or undebug commands, debugging is stopped for the specified protocol. To stop all debugging, use the all parameter with these commands.
(config)# no debug bgp events
or
# undebug all
Debug Modes
Debug commands act differently depending on the mode within which they are entered.
• In configure mode, debug session commands persist across switch reboots (if configuration is saved), and can be viewed in the running configuration using the show running-config command.
• In privileged exec mode, debug session commands do not appear in the running configuration, and can be viewed only by entering the show debug command. Additionally, exec debug commands do not persist across switch reboots.