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

Incomplete support for logging to NUL on Windows

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Logging
    • Server Security

      On Linux/Mac, server daemons support setting the log path to /dev/null via the log path:

      > mongod --logpath /dev/null
      

      The equivalent invocation fails on Windows:

      > mongod --logpath NUL
      Failed global initialization: FileRenameFailed Could not rename preexisting log file "C:\Projects\MongoDb\dist-test\bin\NUL" to "C:\Projects\MongoDb\dist-test\bin\NUL.2020-03-02T12-45-03"; run with --logappend or manually remove file: Cannot create a file when that file already exists
      

      You can work around this by using log append:

      > mongod --logappend --logpath NUL
      

      One other small behavioral difference: on WIndows that invocation produces no output. But on OS X you get one line of output:

      ~$ mongod --logappend --logpath /dev/null
      2020-03-02T09:11:33.735-0500 I  CONTROL  [main] ***** SERVER RESTARTED *****
      

            Assignee:
            backlog-server-security [DO NOT USE] Backlog - Security Team
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: