Makes entries in the system log.
The logger command provides an interface to the syslog subroutine, which writes entries to the system log. A Message variable can be specified on the command line, which is logged immediately, or a File variable is read and each line of the File variable is logged. If you specify no flags or variables, the logger command will wait for you to enter a message from standard input. The messages returned by the LOG_KERN facility cannot be logged by this command.
Item | Description |
---|---|
-f File | Logs the specified File variable. If the Message variable is specified, this flag is ignored. |
-i | Logs the process ID of the logger process with each line. |
-p Priority | Enters the message with the specified priority. The Priority parameter may be a number or a facility.level priority specifier. |
-t Tag | Marks every line in the log with the specified Tag parameter. |
Message | Indicates the message to log. If this variable is not specified, the logger command logs either standard input or the file specified with the -f File flag. |
-r Count | If the buffer resource is not available, retries logging the message for the specified number of times. If the number is not specified, retries logging the message until the message is logged. The number must be a positive integer ranging from 1 - 1000. |
logger System rebooted
logger -f /tmp/msg1
logger -pdaemon.crit
This command returns the following exit values:
Item | Description |
---|---|
0 | Successful completion. |
>0 | An error occurred. |
Item | Description |
---|---|
/usr/bin/logger | Contains the logger command. |