How to use the log4js.clearAppenders 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 fontello / fontello / lib / system / runner / initialize.js View on Github external
};

  //
  // Load supported appenders
  //

  log4js.loadAppender('file');
  log4js.loadAppender('console');
  log4js.loadAppender('clustered');
  log4js.loadAppender('logLevelFilter');

  //
  // clear default loggers
  //

  log4js.clearAppenders();

  function clusteredAppender(children, category) {
    let clusterAppenderConfig = {
      appenders: [],      // configs
      actualAppenders: [] // functions
    };

    children.forEach(appender => {
      clusterAppenderConfig.appenders.push({ category });
      clusterAppenderConfig.actualAppenders.push(appender);
    });

    return log4js.appenders.clustered(clusterAppenderConfig);
  }

  //
github nodeca / nodeca / lib / runner / initialize.js View on Github external
if (threshold) {
      level = log4js.levels.toLevel(threshold, baseLevel);

      // get upper threshold
      level = level.isGreaterThanOrEqualTo(baseLevel) ? level : baseLevel;
    }

    // return thresholded appender
    return log4js.appenders.logLevelFilter(level, appender);
  }

  //
  // clear default loggers
  //

  log4js.clearAppenders();

  //
  // configure console logger for non-production environment only
  //

  if ('production' !== N.runtime.env) {
    log4js.addAppender(log4js.appenders.console());
  }

  //
  // leave only loggers (with appenders) configs, removing keywords
  //

  delete config.options;

  //
github danielbeardsley / cimpler / lib / cimpler.js View on Github external
function Cimpler(config) {
   if (config && config.testMode) {
      log4js.clearAppenders();
   }

   var builds = new NotifyQueue();
   var cimpler = this;
   var connect;
   var connectServer;
   var running = true;
   var consumers = [];

   this.plugins = [];
   config = config || {};

   this.addBuild = function(build) {
      build.status = build.status || 'pending';

      // The _control property allows plugins to pass around data
github jivesoftware / jive-sdk / jive-sdk-service / lib / service.js View on Github external
function initLogger(options) {
    var customLoggingAppender = options['customServiceLogger'];

    if ( customLoggingAppender ) {
        // clear the default appender(s)
        log4js.clearAppenders();

        //
        log4js.addAppender(customLoggingAppender, 'jive-sdk');
    }

    var logfile = options['logFile'] || options['logfile'];
    var logLevel = process.env['jive_logging_level'] || options['logLevel'] || options['loglevel'] || 'INFO';
    logLevel = logLevel.toUpperCase();

    if (logfile) {
        if (logfile.indexOf('logs/') === 0) {
            if (!fs.existsSync('logs')) {
                jive.logger.warn('logs subdirectory does not exist. Creating directory now.');
                fs.mkdirSync('logs');
            }
        }