What is best way to log my express js webserver? The inbuilt express.logger() just displays logs on screen. Can I also log them into a file in /log folder? Also the current
To send the express or connect logs to a file use Node's writeStream. For example to send the express logs to ./myLogFile.log :
open the stream to your file in append mode with :
var logFile = fs.createWriteStream('./myLogFile.log', {flags: 'a'}); //use {flags: 'w'} to open in write mode
then, in your express config use :
app.use(express.logger({stream: logFile}));
should also work for connect.logger.