Running node.js without automatic logs

I would like to run the node.js application without the automatic logs that it prints in the terminal when responding to the request (for example, 127.0.0.1 - - [Wed, 20 Jun 2012 09:55:49 GMT] "GET /url HTTP/1.1" 200 1559 "http://localhost:3020/url" ... ). In addition, I would like my logs from console.log() to remain visible.

Does anyone know how to do this? I am running express.js on top of node.

thanks

+7
source share
1 answer

Like the brand, I think you are using logger middleware somewhere in your code. You must disable this part, especially in production mode . Use something like this:

 app.configure(function(){ app.use(express.methodOverride()); app.use(express.bodyParser()); app.use(app.router); }); app.configure('development', function(){ app.use(express.static(__dirname + '/public')); app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); }); app.configure('production', function(){ var oneYear = 31557600000; app.use(express.static(__dirname + '/public', { maxAge: oneYear })); app.use(express.errorHandler()); }); 
+7
source

All Articles