Docs HomeMongoDB Compass

Retrieve Compass Logs检索Compass日志

As part of normal operation, MongoDB Compass maintains a running log of events. 作为正常操作的一部分,MongoDB Compass维护事件的运行日志。Compass logs provide a history of operations and can help diagnose errors.Compass日志提供操作历史记录,有助于诊断错误。

Note

MongoDB Compass redacts credentials from the logs.MongoDB Compass会对日志中的凭据进行编辑。

View Compass Logs查看Compass日志

1

In the Compass top menu bar, click Help.在Compass顶部菜单栏中,单击“帮助”。

2

In the Help menu, click Open Log File.在“帮助”菜单中,单击“打开日志文件”。

Compass opens a dialog containing the location of your log file.Compass将打开一个对话框,其中包含日志文件的位置。

3

Choose how to open the log file.选择如何打开日志文件。

You can either:您可以:

  • Copy the path to the log file to your clipboard.将日志文件的路径复制到剪贴板。
  • Open the folder containing your log file.打开包含日志文件的文件夹。
  • Extract the log file and view it as a text file.提取日志文件并将其作为文本文件查看。

Compass Log LocationCompass日志位置

Compass maintains one log file per session, compressed into a gzip archive file. Compass为每个会话维护一个日志文件,压缩为gzip归档文件。The corresponding session ID is included in the log file name.相应的会话ID包含在日志文件名中。

The directory where Compass writes logs depends on your operating system.Compass写入日志的目录取决于您的操作系统。

Operating System操作系统Directory目录
macOS~/.mongodb/compass/<LogID>_log.gz
Linux~/.mongodb/compass/<LogID>_log.gz
Windows%UserProfile%/AppData/Local/mongodb/compass/<LogID>_log.gz

Log File Format日志文件格式

Compass outputs log messages in structured JSON format. Compass以结构化JSON格式输出日志消息。The messages are written in the same format used for MongoDB server logs.这些消息是用与MongoDB服务器日志相同的格式编写的。

Tip

See also:

To learn more about MongoDB logs and see examples, see Log Messages.要了解有关MongoDB日志的更多信息并查看示例,请参阅日志消息

Log Retention日志保留

Compass retains log files for 30 days. Compass将日志文件保留30天。Log files older than 30 days are automatically deleted.超过30天的日志文件将自动删除。