Index: /trunk/FACT++/src/datalogger.cc
===================================================================
--- /trunk/FACT++/src/datalogger.cc	(revision 11499)
+++ /trunk/FACT++/src/datalogger.cc	(revision 11500)
@@ -969,4 +969,5 @@
     {
 //        dim_lock();
+        fNightlyLogFile << endl;
         fNightlyLogFile.close();
 //        dim_unlock();
@@ -1233,4 +1234,5 @@
             Debug("Its Noon! Closing and reopening nightly text files");
 
+        fNightlyLogFile << endl;
         fNightlyLogFile.close();
         fNightlyReportFile.close();
@@ -1246,4 +1248,5 @@
             return;
         }
+        fNightlyLogFile << endl;
 
         fFullNightlyReportFileName = CompileFileNameWithPath(fNightlyFilePath, "", "rep");
@@ -1336,7 +1339,8 @@
             //remove this subscription from the list.
             //because these operators use references to elements, and because they're supposed here to erase these objects on the way, I'm not too sure... so duplicate the names !
-            string server = sub.server;
-            string service = sub.service;
-            fServiceSubscriptions.find(server)->second.erase(service);
+            RemoveService(sub.server, sub.service, false);
+//            string server = sub.server;
+//            string service = sub.service;
+//            fServiceSubscriptions.find(server)->second.erase(service);
             return;
         }
@@ -1397,7 +1401,8 @@
             //remove this subscription from the list.
             //because these operators use references to elements, and because they're supposed here to erase these objects on the way, I'm not too sure... so duplicate the names !
-            string server = sub.server;
-            string service = sub.service;
-            fServiceSubscriptions.find(server)->second.erase(service);
+            RemoveService(sub.server, sub.service, false);
+//            string server = sub.server;
+//            string service = sub.service;
+//            fServiceSubscriptions.find(server)->second.erase(service);
             return;
         }
@@ -1776,7 +1781,9 @@
     }
     fFullNightlyLogFileName = CompileFileNameWithPath(fNightlyFilePath, "", "log");
+    bool nightlyLogOpen = fNightlyLogFile.is_open();
     if (!OpenTextFilePlease(fNightlyLogFile, fFullNightlyLogFileName))
         return kSM_BadNightlyConfig;
-
+    if (!nightlyLogOpen)
+        fNightlyLogFile << endl;
 
     fFullNightlyReportFileName = CompileFileNameWithPath(fNightlyFilePath, "", "rep");
@@ -2002,4 +2009,5 @@
             {
                 sub.nightlyFile.Close();
+                RemoveService(sub.server, sub.service, false);
                 GoToNightlyWriteErrorState();
                 return;
@@ -2012,4 +2020,5 @@
             {
                 sub.runFile.Close();
+                RemoveService(sub.server, sub.service, false);
                 GoToRunWriteErrorState();
                 return;
@@ -2385,4 +2394,5 @@
          else
          {
+             fNightlyLogFile << endl;
              NotifyOpenedFile(fFullNightlyLogFileName, 1, fOpenedNightlyFiles);
              for (vector<string>::iterator it=backLogBuffer.begin();it!=backLogBuffer.end();it++)
