mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 00:02:54 -04:00
Merge pull request #5303 from owncloud/fix-unlogged-session-error
Log an error when session initialization fails before ownCloud is intalled
This commit is contained in:
commit
8be9773c73
2 changed files with 6 additions and 3 deletions
|
|
@ -304,9 +304,8 @@ class OC {
|
|||
self::$session = new \OC\Session\Internal(OC_Util::getInstanceId());
|
||||
// if session cant be started break with http 500 error
|
||||
} catch (Exception $e) {
|
||||
OC_Log::write('core', 'Session could not be initialized',
|
||||
OC_Log::write('core', 'Session could not be initialized. Exception message: '.$e->getMessage(),
|
||||
OC_Log::ERROR);
|
||||
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
OC_Util::addStyle("styles");
|
||||
$error = 'Session could not be initialized. Please contact your ';
|
||||
|
|
|
|||
|
|
@ -59,10 +59,14 @@ class OC_Log_Owncloud {
|
|||
}
|
||||
$time = new DateTime(null, $timezone);
|
||||
$entry=array('app'=>$app, 'message'=>$message, 'level'=>$level, 'time'=> $time->format($format));
|
||||
$entry = json_encode($entry);
|
||||
$handle = @fopen(self::$logFile, 'a');
|
||||
if ($handle) {
|
||||
fwrite($handle, json_encode($entry)."\n");
|
||||
fwrite($handle, $entry."\n");
|
||||
fclose($handle);
|
||||
} else {
|
||||
// Fall back to error_log
|
||||
error_log($entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue