View Shell Logs
On this page
The MongoDB Shell stores logs for each session. The default log location depends on your operating system.
1
2
View the log for the session.
MongoDB Shell saves the log for each session to your user's
.mongodb/mongosh
directory:
~/.mongodb/mongosh/<LogID>_log
Run the following command to view the log for a session:
cat ~/.mongodb/mongosh/<LogID>_log
Run the following command to tail the log for a session:
tail -f ~/.mongodb/mongosh/<LogID>_log
MongoDB Shell saves the log for each session to your user's
C:\Users\<username>\AppData\Local\
directory:
UserProfile%/AppData/Local/mongodb/mongosh/<LogID>_log
Run the following PowerShell command to view the log for a session:
Get-Content %UserProfile%/AppData/Local/mongodb/mongosh/<LogID>_log
Run the following PowerShell command to tail the log for a session:
Get-Content %UserProfile%/AppData/Local/mongodb/mongosh/<LogID>_log
Tip
To change where MongoDB Shell writes logs, see Specify Log File Location.