sails logging to file

rcheuk picture rcheuk · Dec 9, 2013 · Viewed 9.3k times · Source

Can someone provide an example of how to configure sails.js to log to a file?

It seems like it should be straightforward, but I'm having trouble finding examples online.

I'm looking at changes in the config/log.js or the config/sockets.js files.

Answer

bredikhin picture bredikhin · Dec 11, 2013

According to the source code, for v0.9.x, you just have to set the filePath in your config/log.js:

module.exports = {
  log: {
    level: 'info',
    filePath: 'application.log'
  }
};