Miscellaneous
logger
Write messages to the system log (syslog) from the command line.
Synopsis
syntax
logger [OPTION]... [MESSAGE]
Examples
Write info message to syslog
logger 'Backup completed successfully'
Log with custom tag and priority
logger -t myapp -p local0.error 'DB connection failed'
Log and print to stderr
logger -s 'Debug: checking config'
Log file contents to syslog
logger -f /var/log/app/errors.txt
Common options
| Flag | Description |
|---|---|
| -t | Log tag (defaults to username) |
| -p | Priority (facility.level) |
| -s | Also output to stderr |
| -f | Log contents of file |
About logger
The `logger` command write messages to the system log (syslog) from the command line. Utility commands cover a broad range of everyday tasks from date manipulation and arithmetic to terminal control and system documentation.
These tools fill in the gaps between major categories and are frequently used in shell scripts, cron jobs, and interactive sessions. The command accepts 4 commonly used flags shown above, though the full set of options is available in the man page (`man logger`).
The 4 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More Miscellaneous Commands
Other commands in the Miscellaneous category