To log personal messages to /var/log/messages when you write script, you can use logger
logger i am testing
And check the result with tail, it display last 10 line of messages by default
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.