Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-20172

Clean up newline chars in log messages

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Logging
    • Service Arch
    • ALL

      The "setShardVersion failed!" log line has a needless newline in it; this should be changed to ":<space>", like the "setShardVersion success:" message above it. See SERVER-13069 for rationale.

      src/mongo/s/version_manager.cpp:386
          LOG(1) << "       setShardVersion failed!\n" << result;
      

      Verbose query planning logging makes use of newlines in log messages by necessity for readability purposes. This isn't a problem.

      Additionally some log lines use "\n" as their terminator; these could be cleaned up to use endl instead:

      $ ag 'LOG\(.*\\n'
      db/exec/multi_plan.cpp
      125:        LOG(5) << "Best plan errored out switching to backup\n";
      143:        LOG(5) << "Best plan had a blocking stage, became unblocked\n";
      253:    LOG(5) << "Winning solution:\n" << bestSolution->toString() << endl;
      258:        LOG(5) << "Winner has blocking stage, looking for backup plan...\n";
      261:                LOG(5) << "Candidate " << ix << " is backup child\n";
      
      db/repl/master_slave.cpp
      865:    LOG(2) << "sync_pullOpLog " << ns << " syncedTo:" << syncedTo.toStringLong() << '\n';
      916:        LOG(2) << "tailing=true\n";
      939:            LOG(2) << "tailing & no new activity\n";
      975:        LOG(2) << "first op time received: " << nextOpTime.toString() << '\n';
      977:            LOG(1) << "initial run\n";
      
      db/storage/mmap_v1/mmap_v1_extent_manager.cpp
      469:        LOG(n < 512 ? 1 : 0) << "warning: newExtent " << n << " scanned\n";
      
      db/query/planner_analysis.cpp
      693:        LOG(5) << "PROJECTION: Current plan is:\n" << solnRoot->toString() << endl;
      699:            LOG(5) << "PROJECTION: claims to require doc adding fetch.\n";
      710:            LOG(5) << "PROJECTION: requires fields\n";
      
      db/query/query_planner.cpp
      420:    LOG(5) << "Planner: solution constructed from the cache:\n" << soln->toString();
      468:            LOG(5) << "Forcing a table scan due to hinted $natural\n";
      787:    LOG(5) << "Planner: outputted " << out->size() << " indexed solutions.\n";
      
      db/query/find.cpp
      460:    LOG(5) << "getMore returned " << numResults << " results\n";
      487:    LOG(5) << "Running query:\n" << cq->toString();
      662:        LOG(5) << "Not caching executor but returning " << numResults << " results.\n";
      
      s/version_manager.cpp
      386:    LOG(1) << "       setShardVersion failed!\n" << result;
      
      util/tcmalloc_server_status_section.cpp
      69:    LOG(1) << "tcmallocPoolSize: " << tcmallocPoolSize << "\n";
      

            Assignee:
            backlog-server-servicearch [DO NOT USE] Backlog - Service Architecture
            Reporter:
            kevin.pulo@mongodb.com Kevin Pulo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: