Home » Nodejs » Node.js log4j-like logging system

Node.js log4j-like logging system

Posted by: admin November 29, 2017 Leave a comment

Questions:

Could you recommend me a good log4j-like logging system for node.js?

Answers:

It’s not a log4j port, but Winston offers some similar functionality. https://github.com/indexzero/winston

Questions:
Answers:

I think Winston is really good, however since you mentioned log4j you might be interested in the node port: node-log4js

Questions:
Answers:

LIGHEWEIGHT SOLUTION

I have looked through many loggers, and I wasn’t able to find a lightweight solution – so I decided to make a simple solution that is posted on github.

  • Saves the file
  • Gives you a pretty output (we all love that)
  • Easy to use

I hope this helps you out.

SETUP

https://github.com/bluejamesbond/Scribe.js

PS: If there are any problems, I would appreciate it if you can fix it and then do a pull request. Otherwise, you are more than welcome to post as an issue.

Questions:
Answers:

You can also try looking at https://www.npmjs.org/package/bunyan

Its output is JSON format and can have different stream for output like stoud, log file along with option to number of files to maintain before rotate/recycle similar to Log4j.

As per the documentation on npm, it is also used by Joyent in the production.