user2386411
user2386411

Reputation: 133

Printing mongodump or mongorestore command output to a log file

I am using this command to save output to a file.

mongorestore --host %computerName%:%_portnumber% -u Admin -p user --oplogReplay %_sourceFolder% >> D:\Data\admin\abc.log

This creates an empty file and all the output is listed on the command prompt.

Is there a way to get the output to a file? Any help is greatly appreciated.

Upvotes: 6

Views: 5885

Answers (1)

tao hiko
tao hiko

Reputation: 123

On Windows, I use below this

mongodump.exe /d test /o C:\Work 2> C:\temp\testdump.log

Actually, stream2 is STDERR but it works for MongoDB.

More info

Upvotes: 4

Related Questions