]> source.dussan.org Git - nextcloud-server.git/commitdiff
Handle ownCloud logging when data dir not created
authorTom Needham <tom@owncloud.com>
Fri, 11 Oct 2013 16:16:37 +0000 (17:16 +0100)
committerTom Needham <tom@owncloud.com>
Fri, 11 Oct 2013 16:16:37 +0000 (17:16 +0100)
lib/base.php
lib/private/log/owncloud.php

index d4400dcf69c95d1ef6bf9b81924ef5b21d0a3a6e..4744491141e3cb3fdf85860cd7212da805309b21 100644 (file)
@@ -304,12 +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) {
-                       if(!OC_Config::getValue('installed')) {
-                               error_log('Session could not be initialized');
-                       } else {
-                               OC_Log::write('core', 'Session could not be initialized',
-                                       OC_Log::ERROR);
-                       }
+                       OC_Log::write('core', 'Session could not be initialized',
+                               OC_Log::ERROR);
                        header('HTTP/1.1 500 Internal Server Error');
                        OC_Util::addStyle("styles");
                        $error = 'Session could not be initialized. Please contact your ';
index f3b4358440991b6cbdb8151a0a27c91b7336e12a..a408e3830d6da34987c465373bddce263889705d 100644 (file)
@@ -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);
                        }
                }
        }