Database Reference
In-Depth Information
Using database logs
A MongoDB instance emits all database activities with log messages. According to the in-
stance configuration, the database engine emits logs into a logfile or prints them in the con-
sole.
These log messages are useful when you face an issue with your database instance. You can
read the logfiles and check the database. Most of the time, these log messages come in
handy when you have trouble establishing and running a database instance.
There are a few options that you can use to control and manage logging for your database
instance.
systemLog.quiet : This is a Boolean value that defines the verbosity level of
the MongoDB instance. The default value is false , and on setting this value to
true , the log system doesn't record logs for the following actions:
◦ The output of database commands
◦ Replication
◦ Connection accepted and closed
systemLog.path : This is a string value that defines the path to save the logfile.
By defining this value, you force the instance to emit the log messages into a file
instead of returning them as a standard output.
Please note that MongoDB overwrites logfiles by default after each restart of the
database. You can change this option using the systemLog.logAppend option
described in next section.
systemLog.logAppend : This is a Boolean value, which is defined to append
log messages to the existing file instead of overwriting logfiles. The value is
false by default.
Consider the following configuration file:
dbpath = /usr/local/var/mongodb/
logpath = /var/log/mongodb.log
port = 27017
By using the preceding configuration file, the database engine emits logfiles into /var/
log/mongodb.log , but it overwrites logfiles after each restart of the instance.
Search WWH ::




Custom Search