๐ŸŽ New User? Get 20% off your first purchase with code NEWUSER20 ยท โšก Instant download ยท ๐Ÿ”’ Secure checkout Register Now โ†’
Menu

Categories

๐Ÿ’ก Logging & Monitoring October 6, 2026 8

Linux Command: logger

Send messages to the system log

Terminal โ€” Logging & Monitoring
Command
$ logger "Backup completed successfully"

logger makes entries in the system log (syslog). It provides a way for shell scripts and commands to write messages to the standard logging infrastructure. logger is the proper way for scripts to log messages. Instead of writing to custom log files, logger sends messages to rsyslog/journald where they are managed, rotated, and searchable. logger supports setting priority levels, tags, and facilities. Messages appear in /var/log/syslog, journalctl, or other configured log destinations.

Syntax

logger [OPTION]... [MESSAGE]

Key Options

  • -p โ€” Set priority (facility.level)
  • -t โ€” Set tag (program name)
  • -s โ€” Also output to stderr
  • -i โ€” Include PID

Examples

Simple log message

logger "Backup completed successfully"

Tagged message

logger -t backup-script "Daily backup finished, 2.5GB compressed"

Error priority

logger -p user.err -t myapp "Failed to connect to database"

Pro Tips

  • -t tag makes log messages filterable: journalctl -t backup-script shows only your messages.
  • Priorities: emerg, alert, crit, err, warning, notice, info, debug. Default is user.notice.
  • Log messages are stored in plain text and may be forwarded to remote servers. Never log passwords or tokens.

Learn more: Full logger reference โ†’

Share this tip