mongoose debug log to separate file

debugging, express, mongoose, node.js

Solution

the great aaron heckmann answered this in Logging outbound queries

mongoose.set('debug', function (collectionName, method, query, doc [, options]) {

  //save to file what you need

});

Problem

I set the mongoose debug to true. mongoose.set('debug', true) But now the debug log is printing in console.I need to specify a separate file for mongoose debug so that I can check the queries if needed.How can I do that?

Original source