Search code examples
node.jsloggingwinston

winston logger make logs file by default


I just require winston in example.js file like this

var winston = require('winston');

//Bla Bla Bla Bla

When run this code winston make two files example.log and example_err.log, i just to know is it default winston behavior or something in my code makes winston act like that?

just in case i don't use any winston.info or winston.error.

UPDATE 1

example.log contains all output of stdout, and example_err.log contains all exception happened in example.js


Solution

  • I would suggest to add your own transports, like this:

    winston.add(winston.transports.File, { filename: 'somefile.log' });

    You can also search your code and see if you added a transport somewhere, with winston.add.

    I also suggest checking out the documentation here: https://github.com/winstonjs/winston