A script to aid in script logging/debugging

Aug 21, '06 07:30:03AM

Contributed by: danger guy

As a Mac OS X administrator and as someone who likes to use shell and perl scripts to automate things, I find myself doing a lot of debugging and logging. To make things simpler, I wrote a perl script which I call from other scripts to output errors, warnings, and info in an ordered, easy-to-read system-log-like format.

Save the script text to a file (logger.pl), open Terminal and change the file mode to allow execution (chmod u+x /path/to/logger.pl), and call the script within (or without) another a script like this:

logger.pl /path/to/your.log calling-process "log text"
Note the log file will be created if it doesn't already exist.

[robg adds: I haven't tested this one...]

Comments (6)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20060817073835480