disable request logs in express.js to console

2,855 views
Skip to first unread message

manjunath

unread,
Oct 4, 2014, 10:38:01 PM10/4/14
to nod...@googlegroups.com
hi

we are using express.js app and we are running it using following command

node app.js

it sends a lot of request logs to the console, sometimes with errors too, we also use it to output some info on console.

what we are looking is how we can disable only request logs.

thanks

mscdex

unread,
Oct 5, 2014, 11:20:29 AM10/5/14
to nod...@googlegroups.com
On Saturday, October 4, 2014 10:38:01 PM UTC-4, manjunath wrote:
what we are looking is how we can disable only request logs.

Assuming the logger middleware you're using is `morgan`, then you can set a `skip`[1] function that allows you to return whether a particular request should be logged or not.

[1] https://github.com/expressjs/morgan#skip

tpx1

unread,
Oct 5, 2014, 1:07:16 PM10/5/14
to nod...@googlegroups.com
hi

wich version of express did you use?
I think this article would help:

https://stackoverflow.com/questions/11118116/running-node-js-without-automatic-logs

julien brunet

unread,
Oct 5, 2014, 1:07:21 PM10/5/14
to nod...@googlegroups.com
hi,

just remove morgan module, its the http request logger middleware.

https://github.com/expressjs/morgan
Reply all
Reply to author
Forward
0 new messages