This use of log handler is intersting -- i hadnot heard of it before -- I cahnged my script thussly:
#!/usr/local/bin/perl # now WITH Log Handler # 2592000 = 30 day n min (60 *60 * 24 *30 ) use strict; use POSIX; use warnings; use Log::Handler::Simple; my $log = Log::Handler::Simple->new( filename => '/script_logs/30DyDlt-LOG.txt', mode => 'append', newline => 1, maxlevel => 7, minlevel => 0 ); # change the below to dlt - dl30 ## my $logfile = "/script_logs/30DyDlt-LOG.txt"; my $date = localtime(); my $dir = '/oven_web/iportal/cgi-bin/uploads'; opendir(DIR,$dir) || die "Can't open $dir : $!\n"; my @files = readdir(DIR); # you may want to grep only certain files he +re close(DIR); ### my $logmsg = $date/$dir/$file; ###my $logmsg = "$date/$dir/$file"; $log->info #print $logmsg = $date/$dir/$file; open LOGFILE, ">> $logmsg " or die " cannot open logfie $logfile for a +ppend $!"; foreach my $file(@files) { my $now = time; my @stat = stat("$dir/$file"); if ($stat[9] < ($now - 2592000)) { print "Deleting $dir/$file..."; #unlink("$dir/$file"); #print "Done.\n"; $log->info("$date/$dir/$file"); } } close LOGFILE;
i just noted i - likely need to snip off :: close LOGFILE but that is not my - real problem . Of course I have not done it correctly . and it "lOOks like my Perl is ' missing ' something. an attempt to run blows up like this. . /usr/bin/perl /oven_script/tst/dlt30day-oven1d-j4.pl Can't locate Log/Handler/Simple.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /oven_script/tst/dlt30day-oven1d-j4.pl line 7. BEGIN failed--compilation aborted at /oven_script/tst/dlt30day-oven1d-j4.pl line 7. well. it is a new record for me on total numberof chars in an error --- so that much was fun!

In reply to Re^3: how to log a process by zimbot
in thread how to log a process by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.