Handle ownCloud logging when data dir not created
This commit is contained in:
parent
cb110c0679
commit
cf7ea4bec5
|
@ -304,12 +304,8 @@ class OC {
|
||||||
self::$session = new \OC\Session\Internal(OC_Util::getInstanceId());
|
self::$session = new \OC\Session\Internal(OC_Util::getInstanceId());
|
||||||
// if session cant be started break with http 500 error
|
// if session cant be started break with http 500 error
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
if(!OC_Config::getValue('installed')) {
|
OC_Log::write('core', 'Session could not be initialized',
|
||||||
error_log('Session could not be initialized');
|
OC_Log::ERROR);
|
||||||
} else {
|
|
||||||
OC_Log::write('core', 'Session could not be initialized',
|
|
||||||
OC_Log::ERROR);
|
|
||||||
}
|
|
||||||
header('HTTP/1.1 500 Internal Server Error');
|
header('HTTP/1.1 500 Internal Server Error');
|
||||||
OC_Util::addStyle("styles");
|
OC_Util::addStyle("styles");
|
||||||
$error = 'Session could not be initialized. Please contact your ';
|
$error = 'Session could not be initialized. Please contact your ';
|
||||||
|
|
|
@ -59,10 +59,14 @@ class OC_Log_Owncloud {
|
||||||
}
|
}
|
||||||
$time = new DateTime(null, $timezone);
|
$time = new DateTime(null, $timezone);
|
||||||
$entry=array('app'=>$app, 'message'=>$message, 'level'=>$level, 'time'=> $time->format($format));
|
$entry=array('app'=>$app, 'message'=>$message, 'level'=>$level, 'time'=> $time->format($format));
|
||||||
|
$entry = json_encode($entry);
|
||||||
$handle = @fopen(self::$logFile, 'a');
|
$handle = @fopen(self::$logFile, 'a');
|
||||||
if ($handle) {
|
if ($handle) {
|
||||||
fwrite($handle, json_encode($entry)."\n");
|
fwrite($handle, $entry."\n");
|
||||||
fclose($handle);
|
fclose($handle);
|
||||||
|
} else {
|
||||||
|
// Fall back to error_log
|
||||||
|
error_log($entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue