How to Use logger on Linux

12872

The logger command provides an easy way to add log files to /var/log/syslog — from the command line, from scripts, or from other files. In today’s post, we’ll take a look at how it works.

How easy is easy?

This easy. Just type logger <message> on the command line and your message will be added to the end of the /var/log/syslog file.

$ logger comment to be added to log
$ tail -1 /vvar/log/syslog
May 21 18:02:16 butterfly shs: comment to be added to log

Command output

You can also add the output from commands by enclosing the commands in backticks.

Read more at Network World