Name
logger
Synopsis
logger [options
] [messages
]
Log messages to the system log. Command-line messages are
logged if provided. Otherwise, messages are read and logged,
line-by-line, from the file provided via -f
. If
no such file is given, logger
reads messages from standard input.
Common Options
-
-f
file
Read and log messages from file.
-
-i
Log the process ID of the logger process with each message.
-
-p
priority
Log each message with the given priority. Priorities have the form facility
.
level. The default isuser.notice
. See syslog (3) for more information.-
-t
tag
Add tag to each message line.
Mac OS X and GNU/Linux Option
-
-s
Send the message to standard error, in addition to sending it to the system log.
GNU/Linux Options
-
-d
When using a specified socket with
-u
, use a datagram socket instead of stream socket.-
-u
socket
Write to socket instead of to the system log.
Example
Warn about upcoming trouble:
logger -p user.emerg 'Incoming Klingon battleship!'
Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.