[Phamm] [PATCH] phamm-0.5.15: logfile timestamp fatally wrong

kabe at sra-tohoku.co.jp kabe at sra-tohoku.co.jp
Thu Feb 5 10:28:37 CET 2009


With Phamm configured to "define ('PHAMM_LOG',1)",
the logfile (/var/log/phamm.log) logged

[YYYY-mm-dd HH:SS] (hour:SECOND!)

not the correct [YYYY-mm-dd HH:MM:SS].
Patch below will fix this.

Additionally, the two calls to date() was aggregeted
in case the clock rolled over between the two calls.

-- 
kabe

--- phamm-0.5.15/lib/phamm.php.dis3	2008-10-05 23:59:44.000000000 +0900
+++ phamm-0.5.15/lib/phamm.php	2009-02-05 18:19:20.000000000 +0900
@@ -115,12 +115,11 @@
 	$logFile = fopen (LOG_FILE,'a');
 
 	// Get time and date
-	$day = date('Y'."-".'m'."-".'d');
-	$hour = date ('H'.":".'s');
+	$ymdhms = date ('Y-m-d H:i:s');
 	$IP = $_SERVER["REMOTE_ADDR"];
 
 	// Prepare the log string
-	$log= "$IP - $user [$day $hour] \"$pn : $operation\" $resultLabel\n";
+	$log= "$IP - $user [$ymdhms] \"$pn : $operation\" $resultLabel\n";
 
 	// Write the log in to file
 	fwrite ($logFile,"$log");


More information about the Phamm mailing list