From 8471340db9a5d33fb2d77974ad3852cd52f016e5 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Wed, 17 Apr 2013 12:24:18 +0200 Subject: [PATCH 1/3] use date and time instead of timestamp --- lib/log/owncloud.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/log/owncloud.php b/lib/log/owncloud.php index 20df52c27b..8c59352829 100644 --- a/lib/log/owncloud.php +++ b/lib/log/owncloud.php @@ -49,7 +49,8 @@ class OC_Log_Owncloud { public static function write($app, $message, $level) { $minLevel=min(OC_Config::getValue( "loglevel", OC_Log::WARN ), OC_Log::ERROR); if($level>=$minLevel) { - $entry=array('app'=>$app, 'message'=>$message, 'level'=>$level, 'time'=>time()); + $time = date("Y-m-d H:i:s", time()); + $entry=array('app'=>$app, 'message'=>$message, 'level'=>$level, 'time'=> $time); $handle = @fopen(self::$logFile, 'a'); if ($handle) { fwrite($handle, json_encode($entry)."\n"); From f7e29eabf29e4bda052ad170df1955fce0ad37ee Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Wed, 17 Apr 2013 14:05:51 +0200 Subject: [PATCH 2/3] fix admin log display and use a more readable format --- lib/log/owncloud.php | 2 +- settings/js/log.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/log/owncloud.php b/lib/log/owncloud.php index 8c59352829..7a11a58833 100644 --- a/lib/log/owncloud.php +++ b/lib/log/owncloud.php @@ -49,7 +49,7 @@ class OC_Log_Owncloud { public static function write($app, $message, $level) { $minLevel=min(OC_Config::getValue( "loglevel", OC_Log::WARN ), OC_Log::ERROR); if($level>=$minLevel) { - $time = date("Y-m-d H:i:s", time()); + $time = date("F d, Y H:i:s", time()); $entry=array('app'=>$app, 'message'=>$message, 'level'=>$level, 'time'=> $time); $handle = @fopen(self::$logFile, 'a'); if ($handle) { diff --git a/settings/js/log.js b/settings/js/log.js index 81117f9e82..84f6d1aa5f 100644 --- a/settings/js/log.js +++ b/settings/js/log.js @@ -55,7 +55,11 @@ OC.Log={ row.append(messageTd); var timeTd=$(''); - timeTd.text(formatDate(entry.time*1000)); + if(isNaN(entry.time)){ + timeTd.text(entry.time); + } else { + timeTd.text(formatDate(entry.time*1000)); + } row.append(timeTd); $('#log').append(row); } From 4679e789e1bd1c485f2c7f74af8d20bcaff1e44f Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Wed, 17 Apr 2013 15:31:05 +0200 Subject: [PATCH 3/3] also adjust template properly for log date fix --- settings/templates/admin.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/settings/templates/admin.php b/settings/templates/admin.php index fdaba95ac1..182168ce9e 100644 --- a/settings/templates/admin.php +++ b/settings/templates/admin.php @@ -214,7 +214,11 @@ endfor;?> message);?> - time));?> + time)){ + p(OC_Util::formatDate($entry->time)); + } else { + p($entry->time); + }?>