Uploaded image for project: 'Mesos'
  1. Mesos
  2. MESOS-7586

Make use of cout/cerr and glog consistent.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 1.5.0
    • None
    • Mesosphere Sprint 62, Mesosphere Sprint 63
    • 3

    Description

      Some parts of mesos use glog before initialization of glog, hence messages via glog might not end up in a logdir:

      WARNING: Logging before InitGoogleLogging() is written to STDERR

      The solution might be:
      cout/cerr should be used before logging initialization.
      glog should be used after logging initialization.

      Usually, main function has initialization pattern like:

      1. load = flags.load(argc, argv) // Load flags from command line.
      2. Check if flags are correct, otherwise print error message to cerr and then exit.
      3. Check if user passed --help flag to print help message to cout and then exit.
      4. Parsing and setup of environment variables. If this fails, EXIT macro is used to print error message via glog.
      5. process::initialize()
      6. logging::initialize()

      Steps 2 and 3 should use cout/cerr to eliminate any extra information generated by glog like current time, date and log level.

      It would be preferable to move step 6 between steps 3 and 4 safely, because logging::initialize() doesn’t depend on process::initialize().
      In addition, initialization of glog should be added, where it's necessary.

      Attachments

        Issue Links

          Activity

            People

              ArmandGrillet Armand Grillet
              abudnik Andrei Budnik
              Alex R Alex R
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: