bithavoc / express-winston

express.js middleware for winstonjs
https://www.npmjs.com/package/express-winston
MIT License
796 stars 187 forks source link

Logger does not log when requests serve with 200 found response codes from server #206

Open mohitzim opened 5 years ago

mohitzim commented 5 years ago

Hi Can we log requests for each static resources which are being called ?

Logger does not log if file is found (200), but it logs when file not found (404). For example, if request is valid like http://domain/css/existingfile.css, Logger doesnot log. However, if request is invalid like http://domain/css/non-existingfile.css, Logger logs with proper 404 status code.

I need log when file is also found (200). How can be expressWinston configured that it logs for all the requests with whatever status code returned by server ?

Regards

yinzara commented 4 years ago

express-winston has a "logger" and "errorLogger" middleware. the "logger" middleware must be "use"ed before any other routes are added. The errorLogger should be added after all the routes are.

The "logger" is what logs non-error responses (i.e. 200).

I would need to see your express-winston/winston config and how you're using the libraries to know what your issue is.