Index: /trunk/FACT++/src/EventBuilderWrapper.h
===================================================================
--- /trunk/FACT++/src/EventBuilderWrapper.h	(revision 11358)
+++ /trunk/FACT++/src/EventBuilderWrapper.h	(revision 11359)
@@ -197,5 +197,5 @@
 
 public:
-    DataFileRaw(uint32_t id) : DataFileImp(id)  { }
+    DataFileRaw(uint32_t id) : DataFileImp(id), fPosTail(0) { }
     ~DataFileRaw() { Close(); }
 
@@ -751,4 +751,5 @@
     bool fDebugStream;
     bool fDebugRead;
+    bool fDebugLog;
 
     int Write(const Time &time, const std::string &txt, int qos)
@@ -798,5 +799,5 @@
         fDimStatistics1 ("FAD_CONTROL/STATISTICS1",      "I:3;I:2;X:4;I:3;I:1;I:2;C:40;I:40;I:40;X:40", ""),
         fDimStatistics2 ("FAD_CONTROL/STATISTICS2",      "I:1;I:280;X:40;I:40;I:4;I:4;I:2;I:2;I:3;C:40",  ""),
-        fDebugStream(false), fDebugRead(false)
+        fDebugStream(false), fDebugRead(false), fDebugLog(false)
     {
         if (This)
@@ -851,4 +852,6 @@
             return;
         }
+
+        fLastMessage.clear();
 
         for (size_t i=0; i<40; i++)
@@ -974,4 +977,6 @@
 
     void SetOutputFormat(FileFormat_t f) { fFileFormat = f; }
+
+    void SetDebugLog(bool b) { fDebugLog = b; }
 
     void SetDebugStream(bool b)
@@ -1332,8 +1337,13 @@
     }
 
+    map<boost::thread::id, string> fLastMessage;
+
     void factOut(int severity, int err, const char *message)
     {
-        // FIXME: Make the output to the console stream thread-safe
+        if (!fDebugLog && severity==99)
+            return;
+
         ostringstream str;
+        //str << boost::this_thread::get_id() << " ";
         str << "EventBuilder(";
         if (err<0)
@@ -1343,9 +1353,10 @@
         str << "): " << message;
 
-        static string last;
-        if (str.str()==last)
+        string &old = fLastMessage[boost::this_thread::get_id()];
+
+        if (str.str()==old)
             return;
-
-        last = str.str();
+        old = str.str();
+
         fMsg.Update(str, severity);
     }
@@ -1705,6 +1716,5 @@
     void factOut(int severity, int err, const char *message)
     {
-        if (severity!=99)
-	    EventBuilderWrapper::This->factOut(severity, err, message);
+        EventBuilderWrapper::This->factOut(severity, err, message);
     }
 
