Basic Node and Express - Implement a Root-Level Request Logger Middleware


I think my code is correct but getting this error message Root level logger should be active. My code is as follows,

app.use(function (req, res, next) {
  console.log(req.method + " " + req.path + " " + "-" + " " + req.ip);

Please let me know where did I go wrong. Thanks.

hello and welcome to fcc forum :slight_smile:

hopefully this topic has your answer in it as well, happy learning :slight_smile:

1 Like

If you are running this locally you might have to update the freeCodeCamp fcc-express-bground dependency. There was a bug that was fixed.

Remove the dependency and delete the lock file, then add it back again.

You can also force IPv4 in server.js if the dependency update gives you any issues.

const dns = require('dns');
1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.