let admin specify timezone for log file entries
This commit is contained in:
parent
0d492afee1
commit
6a411833b9
|
@ -141,6 +141,9 @@ $CONFIG = array(
|
||||||
/* date format to be used while writing to the owncloud logfile */
|
/* date format to be used while writing to the owncloud logfile */
|
||||||
'logdateformat' => 'F d, Y H:i:s',
|
'logdateformat' => 'F d, Y H:i:s',
|
||||||
|
|
||||||
|
/* timezone used while writing to the owncloud logfile (default: UTC) */
|
||||||
|
'logtimezone' => 'Europe/Berlin',
|
||||||
|
|
||||||
/* Append all database queries and parameters to the log file.
|
/* Append all database queries and parameters to the log file.
|
||||||
(watch out, this option can increase the size of your log file)*/
|
(watch out, this option can increase the size of your log file)*/
|
||||||
"log_query" => false,
|
"log_query" => false,
|
||||||
|
|
|
@ -50,9 +50,11 @@ class OC_Log_Owncloud {
|
||||||
$minLevel=min(OC_Config::getValue( "loglevel", OC_Log::WARN ), OC_Log::ERROR);
|
$minLevel=min(OC_Config::getValue( "loglevel", OC_Log::WARN ), OC_Log::ERROR);
|
||||||
if($level>=$minLevel) {
|
if($level>=$minLevel) {
|
||||||
// default to ISO8601
|
// default to ISO8601
|
||||||
$format = OC_Config::getValue('logdateformat', 'c');
|
$format = OC_Config::getValue('logdateformat', 'Y-m-d H:i:s');
|
||||||
$time = date($format, time());
|
$logtimezone=OC_Config::getValue( "logtimezone", 'UTC' );
|
||||||
$entry=array('app'=>$app, 'message'=>$message, 'level'=>$level, 'time'=> $time);
|
$timezone = new DateTimeZone($logtimezone);
|
||||||
|
$time = new DateTime(null, $timezone);
|
||||||
|
$entry=array('app'=>$app, 'message'=>$message, 'level'=>$level, 'time'=> $time->format($format));
|
||||||
$handle = @fopen(self::$logFile, 'a');
|
$handle = @fopen(self::$logFile, 'a');
|
||||||
if ($handle) {
|
if ($handle) {
|
||||||
fwrite($handle, json_encode($entry)."\n");
|
fwrite($handle, json_encode($entry)."\n");
|
||||||
|
|
Loading…
Reference in New Issue