Index: /trunk/FACT++/src/WindowLog.cc
===================================================================
--- /trunk/FACT++/src/WindowLog.cc	(revision 16831)
+++ /trunk/FACT++/src/WindowLog.cc	(revision 16832)
@@ -135,4 +135,12 @@
     fMuxFile.lock();
     fLogFile.close();
+    fMuxFile.unlock();
+}
+
+void WindowLog::WriteFile(const string &sout)
+{
+    fMuxFile.lock();
+    fLogFile << sout;
+    fLogFile.flush();
     fMuxFile.unlock();
 }
@@ -220,10 +228,12 @@
     }
 
+    fQueueFile.emplace(sout);
+    /*
     // Output everything also to the log-file
     fMuxFile.lock();
     fLogFile << sout;
-    fLogFile.flush();
+    //fLogFile.flush();
     fMuxFile.unlock();
-
+    */
     // If we are flushing because of an EOL, we reset also all attributes
 }
Index: /trunk/FACT++/src/WindowLog.h
===================================================================
--- /trunk/FACT++/src/WindowLog.h	(revision 16831)
+++ /trunk/FACT++/src/WindowLog.h	(revision 16832)
@@ -8,4 +8,6 @@
 
 #include <ncurses.h> // A_NORMAL etc
+
+#include "queue.h"
 
 /// Stream manipulators to change the color of a WindowLog stream
@@ -74,4 +76,6 @@
     std::mutex fMuxWindow;     /// Mutex securing output to fWindow
 
+    Queue<std::string> fQueueFile;
+
     static std::string GetAnsiAttr(int m);
 
@@ -79,4 +83,5 @@
     void AddColor(int m);
 
+    void WriteFile(const std::string &);
     void WriteBuffer();
 
@@ -93,13 +98,19 @@
     //! Switch on screen output
     //
-    WindowLog() : std::ostream(this), fPPtr(fBase), fEPtr(fBase+fgBufferSize), fWindow(0), fIsNull(false), fEnableBacklog(true)
+    WindowLog() : std::ostream(this), fPPtr(fBase), fEPtr(fBase+fgBufferSize), fWindow(0), fIsNull(false), fEnableBacklog(true),
+        fQueueFile(std::bind(&WindowLog::WriteFile, this, std::placeholders::_1))
     {
-        fLogFile.rdbuf()->pubsetbuf(0,0); // Switch off buffering
+        //fLogFile.rdbuf()->pubsetbuf(0,0); // Switch off buffering
         setp(&fBuffer, &fBuffer+1);
         *this << '\0';
     }
-    WindowLog(WindowLog const& log) : std::ios(), std::streambuf(), std::ostream((std::streambuf*)&log), fWindow(log.fWindow), fIsNull(false), fEnableBacklog(true)
+    WindowLog(WindowLog const& log) : std::ios(), std::streambuf(), std::ostream((std::streambuf*)&log), fWindow(log.fWindow), fIsNull(false), fEnableBacklog(true),
+        fQueueFile(bind(&WindowLog::WriteFile, this, std::placeholders::_1))
     {
-        fLogFile.rdbuf()->pubsetbuf(0,0); // Switch off buffering
+        //fLogFile.rdbuf()->pubsetbuf(0,0); // Switch off buffering
+    }
+    ~WindowLog()
+    {
+        fQueueFile.wait(false);
     }
 
