Please explain what below command does.

logger_cmd="logger -p local0.info ${program-name}[$$]:"

$logger_cmd "There is some files missing in ${dest-dir}"

How can I write any message in log file?

I wrote below a command, but it didn't show any message in llog.txt. Help me.

 logger -s "any message" -t "WARNING" -f ~/llog.txt

1 Answer 1


See apropos logger:

logger (1) - a shell command interface to the syslog(3) system log module

For details see man logger

-f, --file file

Log the contents of the specified file. This option cannot be combined with a command-line message.

This means that you try to read the message from ~/llog.txt. So it should be cleared "why" you can't find the text "any message" in this file.


If you read this carefully you would understand that all log messages are written to the syslog facility.

If you want to write the messages in one special file, you have to set up your syslog configuration to support this.

How to do depends on the syslog daemon you are using. rsyslogd has very elaborated rules to control this kind of stuff.

  • Can you tell me how can I do this, so that I logged the message that I want. Where the changes required to achieve this.
    – devsda
    Mar 13, 2013 at 4:48
  • @jhamb This depends on the syslogd daemon you are using. I would suggest to ask a new question with more detailed information about your setup. Mar 13, 2013 at 5:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .