How to change the MongoDB log file location in Windows?

The MongoDB log file location is set in the MongoDB configuration file in the systemLog section via the path option, e.g.:

systemLog:
  destination: file
  logAppend: true
  path:  C:\server\mongodb\log\mongod.log

If you change the option, then restart the MongoDB service.