Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

127
Vistas
How to do logging in MEAN Stack

which is the best way to enable logging in node , express , mongoose application? I have been using console logging ;but there is no way to turn it on or off during production. is there something as solid as log4j and can be used in production applications

about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You can use winston.js, https://github.com/winstonjs/winston#logging-levels You can use log levels and specify which level to log in console and which into some logfile

  var logger = new (winston.Logger)({
transports: [
  new (winston.transports.Console)({ level: 'error' }),
  new (winston.transports.File)({
    filename: 'somefile.log',
    level: 'info'
  })
]

});

But there is also log4js https://github.com/nomiddlename/log4js-node

about 4 years ago · Santiago Trujillo Denunciar

0

You can install morgan, Use npm install morgan,

After installing it,require it i.e var morgan = require('morgan'); Since you have express installed, You can then do this to enable morgan, app.use(morgan('dev'));

This should work.

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda