aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-10-12 03:35:33 -0700
committerThomas Müller <thomas.mueller@tmit.eu>2013-10-12 03:35:33 -0700
commit8be9773c730aa51aa771e20cddced89baddf680d (patch)
tree27ff815afdfb5ecfb32e101bfe86bd12540b023c
parente6d034a60b89be0f24702974d9c9d383ee2b374d (diff)
parent14617682c8b0a833655be57f2be80ba2e78658d2 (diff)
downloadnextcloud-server-8be9773c730aa51aa771e20cddced89baddf680d.tar.gz
nextcloud-server-8be9773c730aa51aa771e20cddced89baddf680d.zip
Merge pull request #5303 from owncloud/fix-unlogged-session-error
Log an error when session initialization fails before ownCloud is intalled
-rw-r--r--lib/base.php3
-rw-r--r--lib/private/log/owncloud.php6
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/base.php b/lib/base.php
index ff4ca588213..9068fe76981 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -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 ';
diff --git a/lib/private/log/owncloud.php b/lib/private/log/owncloud.php
index f3b43584409..a408e3830d6 100644
--- a/lib/private/log/owncloud.php
+++ b/lib/private/log/owncloud.php
@@ -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);
}
}
}