Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 545
user2386411 Avatar asked Oct 19 '22 10:10

user2386411


1 Answers

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

like image 87
tao hiko Avatar answered Nov 15 '22 06:11

tao hiko