How to use the log4js.replaceConsole function in log4js

To help you get started, we’ve selected a few log4js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ether / etherpad-lite / src / node / utils / Settings.js View on Github external
//we know this setting, so we overwrite it
    //or it's a settings hash, specific to a plugin
    if(exports[i] !== undefined || i.indexOf('ep_')==0)
    {
      exports[i] = settings[i];
    }
    //this setting is unkown, output a warning and throw it away
    else
    {
      console.warn("Unknown Setting: '" + i + "'. This setting doesn't exist or it was removed");
    }
  }
  
  log4js.configure(exports.logconfig);//Configure the logging appenders
  log4js.setGlobalLogLevel(exports.loglevel);//set loglevel
  log4js.replaceConsole();

  if(!exports.sessionKey){ // If the secretKey isn't set we also create yet another unique value here
    exports.sessionKey = randomString(32);
    console.warn("You need to set a sessionKey value in settings.json, this will allow your users to reconnect to your Etherpad Instance if your instance restarts");
  }

  if(exports.dbType === "dirty"){
    console.warn("DirtyDB is used. This is fine for testing but not recommended for production.");
  }
};
github NetEase / pomelo-logger / lib / logger.js View on Github external
function configureOnceOff(config) {
	if (config) {
		try {
			configureLevels(config.levels);
			if (config.replaceConsole) {
				log4js.replaceConsole();
			} else {
				log4js.restoreConsole();
			}
		} catch (e) {
			throw new Error(
				"Problem reading log4js config " + util.inspect(config) +
				". Error was \"" + e.message + "\" (" + e.stack + ")"
			);
		}
	}
};
github sourcejs / Source / core / logger.js View on Github external
var reloadConf = function(currentConf){
    log4js.configure(currentConf);
    log4js.replaceConsole(log4js.getLogger('app'));
};