Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Logging for System Admin Scripts

by Posthumous (Scribe)
on Dec 28, 2006 at 18:19 UTC ( [id://592112]=perlquestion: print w/replies, xml ) Need Help??

Posthumous has asked for the wisdom of the Perl Monks concerning the following question:

Fellow monks:

I use Perl for various system admin tasks primarily on Win32 machines with Activestate Perl 5.8. Until now, I have been logging my scripts' output with the basic open-file/write/close-file process.

I'd like to begin making my logging easier, more efficient, and consistent. I've been looking for a module that may help me do this. After days of searching, reading, and evaluating, I'm no closer to a choice or even a decision whether a logging module is a good idea.

I'd like to get your opinions on a good logging module for system admin scripts, if such an animal exists.

    Some requirements:
  • Logging will be primarily to record results of the scripts, not for debugging.
  • Logs will be text files...don't want to use the Win32 EventLog.
  • Most logs will be rotated on a varying schedule, depending on the script.
  • Logs should be understandable by humans and easy to parse programmtically if necessary.

If possible, I'd like to stick with modules available through Activestate's ppm repository. Of course, that is not absolutely necessary.

Replies are listed 'Best First'.
Re: Logging for System Admin Scripts
by chargrill (Parson) on Dec 28, 2006 at 18:34 UTC

    Hi Posthumous,

    I was about to recommend Log::Log4Perl, but then thought it might be prudent to see what ActiveState's PPM Build Status Page had to say about it. I scrolled all the way down to Log::Log4Perl, and saw that it passed most of the build tests but one, and thought it might be of value to you. But then I scrolled back up and saw the column heading for the platform for the single failure was Windows :(

    I'd recommend browsing around CPAN for "log" to see what you find that looks to fill your purposes, and then check the ActiveState's PPM Build Status Page for that module.

    HTH



    --chargrill
    s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)

      Log4perl really is worth doing, esp. if you want to never have to worry about your logging system running out of capabilities to meet new requirements as they present themselves.

      I've never done the install myself, but the Log::Log4perl author provides instructions in his FAQ for getting the module working on windows.

      non-Perl: Andy Ford

        Thanks to all for helping me shorten my search from a very long list of modules to two.

        Andy:

        Good news -- the Log4Perl module is in the Activestate repository.

        I'm off to do some installs and experimenting.

Re: Logging for System Admin Scripts
by alpha (Scribe) on Dec 28, 2006 at 18:29 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://592112]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-25 14:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found