Better logging in runJobs.php. Committing for test on server.
authorTim Starling <tstarling@users.mediawiki.org>
Mon, 16 Feb 2009 04:50:26 +0000 (04:50 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Mon, 16 Feb 2009 04:50:26 +0000 (04:50 +0000)
maintenance/runJobs.php

index f75b733..e2a5895 100644 (file)
@@ -43,10 +43,15 @@ while ( $dbw->selectField( 'job', 'job_id', $conds, 'runJobs.php' ) ) {
                        break;
 
                wfWaitForSlaves( 5 );
-               print wfTimestamp( TS_DB ) . "  " . $job->id . "  " . $job->toString() . "\n";
+               $t = microtime( true );
                $offset=$job->id;
+               $status = $job->run();
+               $t = microtime( true ) - $t;
+               $timeMs = intval( $t * 1000 );
                if ( !$job->run() ) {
-                       print wfTimestamp( TS_DB ) . "  Error: {$job->error}\n";
+                       runJobsLog( $job->toString() . " t=$timeMs error={$job->error}" );
+               } else {
+                       runJobsLog( $job->toString() . " t=$timeMs good" );
                }
                if ( $maxJobs && ++$n > $maxJobs ) {
                        break 2;
@@ -54,3 +59,9 @@ while ( $dbw->selectField( 'job', 'job_id', $conds, 'runJobs.php' ) ) {
        }
 }
 
+
+function runJobsLog( $msg ) {
+       print wfTimestamp( TS_DB ) . " $msg\n";
+       wfDebugLog( 'runJobs', $msg );
+}
+