Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
share|improve this question

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.

Note

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.

share|improve this answer
    
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. –  devnull Mar 13 '13 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. –  H.-Dirk Schmitt Mar 13 '13 at 5:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.