Commits

Anonymous committed 0dc0f3a

#i105835# logging::Filehandler::flush flushes, logging::Logger::publish flushes all handlers

Comments (0)

Files changed (2)

extensions/source/logging/filehandler.cxx

     void SAL_CALL FileHandler::flush(  ) throw (RuntimeException)
     {
         MethodGuard aGuard( *this );
-        // nothing to do, our ::osl::File implementation is not buffered
+        if(!m_pFile.get())
+        {
+            OSL_PRECOND(false, "FileHandler::flush: no file!");
+            return;
+        }
+        #if OSL_DEBUG_LEVEL > 0
+            ::osl::FileBase::RC res =
+        #endif
+                m_pFile->sync();
+        OSL_ENSURE(res == ::osl::FileBase::E_None, "FileHandler::flush: Could not sync logfile to filesystem.");
     }
     
     //--------------------------------------------------------------------

extensions/source/logging/logger.cxx

 
         m_aHandlers.forEach< XLogHandler >(
             ::boost::bind( &XLogHandler::publish, _1, ::boost::cref( _rRecord ) ) );
+        m_aHandlers.forEach< XLogHandler >(
+            ::boost::bind( &XLogHandler::flush, _1 ) );
     }
 
     //--------------------------------------------------------------------