IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 19, 2026, 5:23:27 PM (4 months ago)
Author:
cclin33
Message:

update function.php

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippMonitor/czartool/czarpoll.pl

    r42931 r42972  
    2626use czartool::DayMetrics;
    2727use czartool::MetricsIndex;
     28
     29# --- Logging setup ---
     30use IO::Handle;
     31my $log_file = "/tmp/czarpoll.log";
     32open(my $LOG, '>>', $log_file) or die "Cannot open log file $log_file: $!";
     33$LOG->autoflush(1);
     34select($LOG);  # Redirect all print statements to the log file
     35open(STDERR, '>&', $LOG) or die "Cannot redirect STDERR to log file: $!";
    2836
    2937my $period = 60;
     
    149157        my @labels = @{$pantasks->getLabels($server,'gpc1')};
    150158        push (@allLabels, @labels);
     159        #print "[$server gpc1] labels: ", join(", ", @labels), "\n";
    151160
    152161        my @labels2 = @{$pantasks->getLabels($server,'gpc2')};
    153162        push (@allLabels2, @labels2);
     163        #print "[$server gpc2] labels: ", join(", ", @labels2), "\n";
    154164    }
    155165    #The way gpc2 pantasks are set up is different from gpc1. Therefore, the same label can appear in both stdscience and distribution.
     
    309319    while (1) {
    310320
     321        # --- Truncate log file at start of each iteration ---
     322        close($LOG);
     323        open($LOG, '>', $log_file) or die "Cannot reopen log file $log_file: $!";
     324        $LOG->autoflush(1);
     325        select($LOG); # Redirect STDERR (error messages) to the same log file
     326        open(STDERR, '>&', $LOG) or die "Cannot redirect STDERR to log file: $!";
     327
     328        print "\n======================== CZARPOLL ITERATION START ========================\n";
     329        print scalar(localtime) . "\n";
     330        print "==========================================================================\n";
     331
    311332        my $iterationStartTime = time();
    312333 
     
    447468
    448469        print "--------------------------------------------------------------------------\n";
     470        print "Iteration complete at " . scalar(localtime) . "\n";
     471        print "==========================================================================\n";
    449472        if ($iterationTime < $period) {
    450473            print "* Going to sleep\n";
Note: See TracChangeset for help on using the changeset viewer.