Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-30163

Abseil LOG output printed twice in Qt Creator

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • Qt Creator 12.0.1
    • All Other Issues
    • None
    • Windows

    Description

      I have created a simple project which uses Abseil and is built and run inside of Qt Creator.

      When I use any abseil logging, I see the output twice in the Qt Creator "Application Output" pane. Once in red and once again in white (I'm using dark theme). Using `std::cout`, I see the output once as white, as expected. Using `std::cerr`, I see the output once as red, as expected. I cannot figure out how to stop Abseil logging from printing twice. If I run the same process from the command line, the Abseil logs are only printed to stderr, as expected.

      • OS: Windows 10
      • Qt Creator versions tested: 11 & 12
      • Qt version: 6.2.4 MSVC2019 64bit

      Abseil is recently cloned locally as a subdirectory. The commit is `2a636651729cec997a433ce8e363c6344130944e`, though it happens with older versions too.

      Here is the directory structure:

      .
      |-- CMakeLists.txt
      |-- CMakeLists.txt.user
      |-- abseil-cpp
      `-- main.cpp
      

      Here is my main:

      #include <absl/log/globals.h>
      #include <absl/log/initialize.h>
      #include <absl/log/log.h>
      
      #include <iostream>
      
      int main() {
        absl::InitializeLog();
        absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo);
        std::cout << "Cout test" << std::endl;
        std::cerr << "Cerr test" << std::endl;
        LOG(INFO) << "test";
        return 0;
      }
      

      This program will print something like:

      Cout test
      Cerr test
      I0104 17:58:48.312991   20796 main.cpp:12] test
      I0104 17:58:48.312991   20796 main.cpp:12] test
      

      ("Cerr test" and one of the "main.cpp:12] test" lines are red)

      Here is my CMakeLists.txt:

      cmake_minimum_required(VERSION 3.26.4)
      
      project(main LANGUAGES CXX)
      
      add_executable(${PROJECT_NAME}
        main.cpp
      )
      
      set(ABSL_PROPAGATE_CXX_STD ON)
      add_subdirectory(abseil-cpp)
      
      target_link_libraries(${PROJECT_NAME}
      PUBLIC
        absl::log
        absl::log_initialize
      )
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            con Eike Ziller
            sandsnip3r Victor Stone
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes