Questions tagged [morgan]

HTTP request logger middleware for node.js

HTTP request logger middleware for node.js


Related tags

115 questions
56
votes
1 answer

TypeError: winston.Logger is not a constructor with winston and morgan

I tried with Winston for logger. I used in one project their It's working well when I copy paste the code from their to the current existing project than I face an issue like TypeError: winston.Logger is not a constructor let logger = new…
Gunjan Patel
  • 2,342
  • 4
  • 24
  • 45
15
votes
1 answer

Logging in production best practice?

Is it alright to use morgan as logger on production mode, or just throw it away and only use it on development mode? What's the best practice for logging on production mode?
Terry Djony
  • 1,975
  • 4
  • 23
  • 41
12
votes
4 answers

How are you supposed to create Winston logger stream for Morgan in TypeScript

What is the correct way to create a winston logger in TypeScript that will log the express Morgan middleware logging? I found a number of JavaScript samples but have had trouble converting them over to TypeScript, because I get an error Type '{…
JoAMoS
  • 1,459
  • 3
  • 18
  • 27
12
votes
2 answers

morgan deprecated expressjs

I'm learning nodejs an going through tutorial. I faced a problem that tutorial is for older version. I have that code: var express = require('express'), stylus = require('stylus'), logger = require('morgan'), bodyParser =…
gsiradze
  • 4,583
  • 15
  • 64
  • 111
9
votes
4 answers

Logging POST body size using morgan when request is received

I am using 'morgan' library to log my request, time it takes and the size of response. But, for a POST request is there a way I can log the POST request and its body size when it is received?
Shaurya Mittal
  • 764
  • 1
  • 8
  • 19
7
votes
1 answer

Morgan fingerprint rdkit

Working in an example I realized that there are at least two ways of computing morgan fingerprints for a molecule using rdkit. But using the exact same properties in both ways I get different vectors. Am I missing something? First approach: info =…
Fence
  • 323
  • 2
  • 12
6
votes
1 answer

How to properly split logging between requests and responses with Morgan?

Morgan's documentation describes that it's possible to split the logging of requests and responses: split / dual logging The morgan middleware can be used as many times as needed, enabling combinations like: Log entry on request and one on…
falsarella
  • 12,217
  • 9
  • 69
  • 115
5
votes
1 answer

Is it possible to log error messages using morgan?

I am logging request and responses using morgan and everything is working fine. I would like to know if there is any way in which I could log the error messages too? For ex: if a try catch block fails in my application, I am returning a 500 error…
Ayan
  • 2,738
  • 3
  • 35
  • 76
5
votes
0 answers

Less verbose access logs using expressjs/morgan

I am using https://github.com/expressjs/morgan to log HTTP requests and get log output like 169.228.10.248 - - [27/Jan/2019:11:10:39 +0000] "POST /api/Users/ HTTP/1.1" 400 92 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64)…
bkimminich
  • 416
  • 3
  • 11
5
votes
2 answers

stream.write is not a function when using morgan with logger

Basically i am trying to implement logger for the nodejs , using morgan and winston. When i am trying to use morgan , throwing an error of stream.write is not a function. Since i want get the file name , i am passing the module, from module object…
Learner
  • 8,379
  • 7
  • 44
  • 82
5
votes
1 answer

Is there a way to create a custom log format in express.js using Morgan-body?

I am using morgan-body to log HTTP requests and responses in my node.js/express application. Log entries created by this middleware consist of the full request and response HTTP headers, which is too verbose for my needs. This is my morgan-body…
Victor Ian
  • 1,034
  • 13
  • 26
5
votes
0 answers

Do I need to use morgan logger in production if my express app runs on heroku?

I'm using papertrail to view my logs. Will using morgan as an express middleware just slow things down? Does it serve any purpose? Thanks
judgejab
  • 519
  • 1
  • 3
  • 14
4
votes
4 answers

Is there a way to log response body in Morgan?

I want to log the response body in my logs file I have tried morgan-body but I want to log the response in a file not the console The following code will log the request body, so is there a way to log the response too? morgan.token('body', function…
Mohamed Oraby
  • 916
  • 3
  • 8
  • 14
4
votes
2 answers

Winston / Morgan logging avoiding duplicate entries

I just implemented Winston Logging and it works as expected but i came accross a few issues which i cant find answer for. The way winston works as far as i can tell, the set log level and anything below as far as priority gets used, like on error it…
MisterniceGuy
  • 1,646
  • 2
  • 18
  • 41
4
votes
1 answer

Log all API request to mongoDB using morgan and winston with node express

I want to log all request to MongoDB. Each document should have the HTTP method, the person who made the request, the _id of the document that was Update/Inserted/Retrieved and time the request was made. Can someone please assist?
O'Dane Brissett
  • 1,284
  • 1
  • 8
  • 23
1
2 3 4 5 6 7 8