sal/osl/all/log.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 91fb11d1b2b817ff35faeeca62bd633a05f9d130
Author:     Stephan Bergmann <stephan.bergm...@allotropia.de>
AuthorDate: Fri Apr 4 15:05:02 2025 +0200
Commit:     Stephan Bergmann <stephan.bergm...@allotropia.de>
CommitDate: Thu Apr 10 12:03:05 2025 +0200

    Atomically write line plus newline into $SAL_LOG_FILE
    
    At least on Windows, I see log files in the wild that have multiple lines 
from
    different threads combined into one.  This has apparently been broken by
    9f027559557cb132835d8a13cdc0281ad4e757ae "WNT: allow to set log level/path 
from
    file" switching to a use of std::endl, for unclear reasons.  (But, compared 
to
    the version preceding that, keep the
    
      s << '
';
    
    after the ANDROID and sal_use_syslog branches, assuming those don't want a
    newline added anyway.)
    
    Change-Id: Ie68e015e594918d3480d05c741f83948f1c3d69e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183718
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>

diff --git a/sal/osl/all/log.cxx b/sal/osl/all/log.cxx
index f11fc4accd04..c386563babe4 100644
--- a/sal/osl/all/log.cxx
+++ b/sal/osl/all/log.cxx
@@ -366,13 +366,13 @@ void sal_detail_log(
         syslog(prio, "%s", s.str().c_str());
 #endif
     } else {
+        s << '
';
         // avoid calling getLogFile() more than once
         static std::ofstream * logFile = getLogFile();
         if (logFile) {
-            *logFile << s.str() << std::endl;
+            *logFile << s.str();
         }
         else {
-            s << '
';
 #ifdef _WIN32
             // write to Windows debugger console, too
             OutputDebugStringA(s.str().c_str());

Reply via email to