There have been a few changes between log4js 1.x and 2.x (and 0.x too). You should probably read this migration guide if things aren’t working.
npm install log4js
var log4js = require('log4js'); var logger = log4js.getLogger(); logger.level = 'debug'; // default level is OFF - which means no logs at all. logger.debug("Some debug messages");
If you’re writing a library and would like to include support for log4js, without introducing a dependency headache for your users, take a look at log4js-api.
The original log4js was distributed under the Apache 2.0 License, and so is this. I’ve tried to keep the original copyright and author credits in place, except in sections that I have rewritten extensively.