MongoDB 怎么查看日志文件?

默认情况下,MongoDB在此路径/var/log/mongodb/mongodb.log创建日志文件,如果找不到该日志文件,请检查MongoDB配置文件。

日志路径

检查在MongoDB的配置文件/etc/mongod.conf/yourMongoDBpath/mongod.conf ,该logpath定义在何处记录。

/etc/mongod.conf
$ cat /etc/mongod.conf
# mongod.conf

# Where to store the data.

# Note: if you run mongodb as a non-root user (recommended) you may
# need to create and set permissions for this directory manually,
# e.g., if the parent directory isn't mutable by the mongodb user.
dbpath=/var/lib/mongodb3

#where to log
logpath=/var/log/mongodb/mongod.log

#...

参考文献

  1. MongoDB –旋转日志文件
  2. MongoDB – mongod选项

翻译自: https://mkyong.com/mongodb/mongodb-where-is-the-log-file/

你可能感兴趣的:(mongodb)