Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-10076

Flush CppSuite logs so they are shown correctly in evergreen.

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT11.2.0, 6.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • 1
    • Storage Engines - 2022-11-28
    • v6.1

      Evergreen logs in the CppSuite appear out of sync with the logged time by the CppSuite logger. While not really an issue it can make things a bit confusing when viewing CppSuite logs in evergreen. This is happening as we're not flushing when calling std::cout in the Logger component. We call std::endl but it is contained within the ostringstream which drops the std::flush.

      This is a relatively easy fix:

      test/cppsuite/src/common/logger.cpp
      
      diff --git a/test/cppsuite/src/common/logger.cpp b/test/cppsuite/src/common/logger.cpp
      index 4bb0e982a..4de314db9 100644
      --- a/test/cppsuite/src/common/logger.cpp
      +++ b/test/cppsuite/src/common/logger.cpp
      @@ -86,13 +86,13 @@ logger::log_msg(int64_t trace_type, const std::string &str)
       
               std::ostringstream ss;
               ss << time_buf << "[TID:" << std::this_thread::get_id() << "][" << LOG_LEVELS[trace_type]
      -           << "]: " << str << std::endl;
      +           << "]: " << str;
       
               std::lock_guard<std::mutex> lg(_logger_mtx);
               if (trace_type == LOG_ERROR)
      -            std::cerr << ss.str();
      +            std::cerr << ss.str() << std::endl;
               else
      -            std::cout << ss.str();
      +            std::cout << ss.str() << std::endl;
           }
       }
       } // namespace test_harness
      

      See: EVG-18114 for more details.

            Assignee:
            sean.watt@mongodb.com Sean Watt
            Reporter:
            luke.pearson@mongodb.com Luke Pearson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: