Configure Logging

Configure logging to determine the types of messages to log and where to store the messages.

About this task

Note

Note

The platform logs CLILOG and SNMPLOG as INFO. Normally, if you configure the logging level to WARNING, the system skips all INFO messages. However, if you enable CLILOG and SNMPLOG the system logs CLI Log and SNMP Log information regardless of the logging level you configure. This is not the case for other INFO messages.

Procedure

  1. Enter Global Configuration mode:

    enable

    configure terminal

  2. Define which messages to log:

    logging level <0-4>

  3. Write the log file from memory to a file:

    logging write WORD<1-1536>

  4. Show logging on the screen:

    logging screen

Example

Switch:1(config)#logging level 0
Switch:1(config)#logging write log2
Switch:1(config)#logging screen

Variable Definitions

The following table defines parameters for the logging command.

Variable

Value

level <0-4>

Shows and configures the logging level. The level is one of the following values:
  • 0: Information — all messages are recorded

  • 1: Warning — only warning and more serious messages are recorded

  • 2: Error — only error and more serious messages are recorded

  • 3: Manufacturing — this parameter is not available for customer use

  • 4: Fatal — only fatal messages are recorded

screen

Configures the log display on the screen to on. Use the no form of the command to stop the log display on the screen: no logging screen

transferFile <1–10> address {A.B.C.D} filename-prefix WORD<0–200

Transfers the syslog file to a remote FTP or TFTP server. <1–10> specifies the file ID. The address {A.B.C.D} option specifies the IP address. The filename-prefix WORD<0–200> option sets the filename prefix for the log file at the remote host.

write WORD<1-1536>

Writes the log file with the designated string. WORD<1-1536> is the string or command that you append to the log file. If the string contains spaces, you must enclose the string in quotation marks (").