ericsoco
ericsoco

Reputation: 26313

How to setup MongoDB to log to file and stdout?

I understand how to use mongodb.conf to set logpath to log to a file or to stdout, but is there a way to log to both? E.g. pipe stdout to a log file?

Upvotes: 3

Views: 1851

Answers (1)

Schleichardt
Schleichardt

Reputation: 7552

You can use the tee command in UNIX:

/opt/mongodb/bin/mongod | tee mongod.log

If mongodb logs to stdout tee "copies" all output to the file mongod.log.

Upvotes: 3

Related Questions