Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1090

[MONGOSH] Create mechanism to expose _logId within the REPL

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.4.0
    • Affects Version/s: None
    • Component/s: Logging
    • None
    • 2
    • Iteration U (Jan 27 - Feb 10), Iteration Venus
    • Needed
    • Hide

      A new log command is now available in shell.

      The `log.getPath()` returns the log name that includes the current log location and log id.

      The command is listed via `help` and log.help` commands.

      Show
      A new log command is now available in shell. The `log.getPath()` returns the log name that includes the current log location and log id. The command is listed via `help` and log.help` commands.

      The session logId is displayed when mongosh first starts up:

       

      mongosh --port 27500

      Current Mongosh Log ID: 61c1e8daae3c0e4461f2e5c7

      Connecting to: mongodb://127.0.0.1:27500/?directConnection=true&serverSelectionTimeoutMS=2000

      Using MongoDB: 5.2.0-alpha-955-g164367e

      Using Mongosh: 1.1.6

       

       

      It would be useful if there was a way to retrieve the logId later on during a session. Perhaps as a config setting:

      config.get( "logId" )

      or as some sort of variable:

      var sessionLogId

       

       

       

            Assignee:
            alena.khineika@mongodb.com Alena Khineika
            Reporter:
            dave.cuthbert@mongodb.com Dave Cuthbert (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: