--- a/src/main.cxx
+++ b/src/main.cxx
@@ -413,27 +413,6 @@
         if (g_config->get("scsendermpdport", value))
             sendermpdport = atoi(value.c_str());
 
-        // If a streaming service is enabled, we need a Media
-        // Server. We let a static ContentDirectory method decide this
-        // for us. The way we then implement it depends on the command
-        // line option (see the enum comments near the top of the file):
-        enableMediaServer = ContentDirectory::mediaServerNeeded();
-        switch (arg_msmode) {
-        case MSOnly:
-            inprocessms = true;
-            msonly = true;
-            break;
-        case Combined:
-            inprocessms = true;
-            msonly = false;
-            break;
-        case RdrOnly:
-        case Forked:
-        default:
-            inprocessms = false;
-            msonly = false;
-            break;
-        }
     } else {
         // g_configfilename is empty. Create an empty config anyway
         g_config = new ConfSimple(string(), 1, true);
@@ -443,6 +422,35 @@
         }
     }
 
+    if (Logger::getTheLog(logfilename) == 0) {
+        cerr << "Can't initialize log" << endl;
+        return 1;
+    }
+    Logger::getTheLog("")->reopen(logfilename);
+    Logger::getTheLog("")->setLogLevel(Logger::LogLevel(loglevel));
+
+    // If a streaming service is enabled, we need a Media
+    // Server. We let a static ContentDirectory method decide this
+    // for us. The way we then implement it depends on the command
+    // line option (see the enum comments near the top of the file):
+    enableMediaServer = ContentDirectory::mediaServerNeeded();
+    switch (arg_msmode) {
+    case MSOnly:
+        inprocessms = true;
+        msonly = true;
+        break;
+    case Combined:
+        inprocessms = true;
+        msonly = false;
+        break;
+    case RdrOnly:
+    case Forked:
+    default:
+        inprocessms = false;
+        msonly = false;
+        break;
+    }
+
     // If neither OH nor AV are enable, run as pure media server. This
     // is another way to do it besides the -m option
     if (!enableOH && !enableAV) {
@@ -456,12 +464,6 @@
         // the "mediaserver" to redirect URLs for ohcredentials/Kazoo
         ;
     }
-
-    if (Logger::getTheLog(logfilename) == 0) {
-        cerr << "Can't initialize log" << endl;
-        return 1;
-    }
-    Logger::getTheLog("")->setLogLevel(Logger::LogLevel(loglevel));
 
     Pidfile pidfile(pidfilename);
 
@@ -534,7 +536,7 @@
         // Need to rewrite pid, it may have changed with the daemon call
         pidfile.write_pid();
         if (!logfilename.empty() && logfilename.compare("stderr")) {
-            if (chown(logfilename.c_str(), runas, -1) < 0) {
+            if (chown(logfilename.c_str(), runas, -1) < 0 && errno != ENOENT) {
                 LOGERR("chown("<<logfilename<<") : errno : " << errno << endl);
             }
         }