log personal message to /var/log/messages
* * * * * 1 votos
August 14th, 2006 mysurface Posted in Admin, backquote, logger, tail | Hits: 5790 |
To log personal messages to /var/log/messages when you write script, you can use logger
simple example:
logger i am testing
And check the result with tail, it display last 10 line of messages by default
tail /var/log/messages
To put more info to log file, you can specified the timestamp with scriptname by this
logger -t `basename $0` i am still testing
basename is to display scriptname without ./ or the parent’s path, back quote (`) is to pass the result string to logger.
Live Chat!









December 14th, 2007 at 9:43 pm
Thanks, very useful!!!
February 26th, 2008 at 11:25 pm
I have a doubt.How do I write a a message from my program to /var/log/messages ? Is this possible? How?