How to use the log4js.setGlobalLogLevel 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 jimivdw / grunt-mutation-testing / utils / OptionUtils.js View on Github external
function getOptions(grunt, task) {
    var globalOpts = grunt.config(task.name).options;
    var localOpts = grunt.config([task.name, task.target]).options;
    var opts = _.merge({}, DEFAULT_OPTIONS, globalOpts, localOpts);

    // Set logging options
    log4js.setGlobalLogLevel(log4js.levels[opts.logLevel]);
    log4js.configure(LOG_OPTIONS);

    opts.code = expandFiles(opts.code, opts.basePath);
    opts.specs = expandFiles(opts.specs, opts.basePath);
    opts.mutate = expandFiles(opts.mutate, opts.basePath);

    if (opts.karma) {
        opts.karma.notIncluded = expandFiles(opts.karma.notIncluded, opts.basePath);
    }

    var requiredOptionsSetErr = areRequiredOptionsSet(opts);
    if(requiredOptionsSetErr !== null) {
        grunt.warn('Not all required options have been set properly. ' + requiredOptionsSetErr);
        return null;
    }
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 jamesshore / lets_code_javascript / node_modules / karma / lib / logger.js View on Github external
var pattern = colors ? constant.COLOR_PATTERN : constant.NO_COLOR_PATTERN

  // If there are no appenders use the default one
  appenders = helper.isDefined(appenders) ? appenders : [constant.CONSOLE_APPENDER]

  appenders = appenders.map(function (appender) {
    if (appender.type === 'console') {
      if (helper.isDefined(appender.layout) && appender.layout.type === 'pattern') {
        appender.layout.pattern = pattern
      }
    }
    return appender
  })

  // Pass the values to log4js
  log4js.setGlobalLogLevel(level)
  log4js.configure({
    appenders: appenders
  })
}
github nicojs / node-link-parent-bin / src / cli.ts View on Github external
import { ParentBinLinker } from './ParentBinLinker';
import { program } from './program';
import * as log4js from 'log4js';

const options = program.parse(process.argv);
log4js.setGlobalLogLevel(options.logLevel);

new ParentBinLinker(options).linkBinsToChildren()
    .catch(err => {
        console.error('Error Linking packages', err);
        process.exit(1);
    });
github ashubham / webshot-factory / index.ts View on Github external
import * as shotPool from './lib/shot-pool';
import * as Logger from 'log4js';
import * as express from 'express';
import * as internalIp from 'internal-ip';

process.env.loglevel = process.env.loglevel || 'INFO';
process.env.webshotDebugPort = process.env.webshotDebugPort || '3030';
Logger.setGlobalLogLevel(process.env.loglevel);
let app = express();
let ip;
let _logger = Logger.getLogger("index");

internalIp.v4().then(_ip => ip = _ip);

export interface Config extends shotPool.PoolConfig {
    webshotDebugPort?: string;
}

let defaultConfig: Config = {
    concurrency: 10,
    callbackName: '',
    warmerUrl: '',
    width: 800,
    height: 600,
github mechio / takana / index.js View on Github external
exports.run = function(options){

  options         = options || {};

  if (!options.path || !options){
    throw('not invoked with required parameters');
  }

  if (!options.verbose) {
    Log4js.setGlobalLogLevel(Log4js.levels.INFO);
    Log4js.configure({
        appenders: [
        {
          type: 'console',
          layout: {
            type: 'pattern',
            pattern: "%[[%r] [%p] - %]%m"
          }
        }
      ]
    });
  }

  var server = new Server({
    name:         'default',
    path:         options.path,
github dhruvbird / node-xmpp-bosh / src / log.js View on Github external
var set_log_level = function (level) {
	log4js.setGlobalLogLevel(level);
};
github monounity / karma-typescript / packages / karma-typescript-angular2-transform / dist / transform.js View on Github external
var initialize = function (logOptions) {
    log4js.setGlobalLogLevel(logOptions.level);
    log4js.configure({ appenders: logOptions.appenders });
    log = log4js.getLogger("angular2-transform.karma-typescript");
};
var exp = Object.assign(transform, { initialize: initialize });
github dhruvbird / node-xmpp-bosh / src / log.js View on Github external
var log4js = require("log4js");

log4js.configure({
    appenders:[
        { type:"console" }
    ]
});

log4js.setGlobalLogLevel("INFO");

var set_log_level = function (level) {
	log4js.setGlobalLogLevel(level);
};

module.exports = log4js;
module.exports.set_log_level = set_log_level;
github Infactum / faxserver / app.js View on Github external
var config = require('./config'),
    log4js = require('log4js'),
    logger = log4js.getLogger('App');

log4js.setGlobalLogLevel(config.get('logLevel'));

var path = require('path');

var http = require('http'),
    express = require('express'),
    app = express(),
    server = http.createServer(app),
    io = require('socket.io').listen(server, {
        logger: require('./lib/socketioLogWrapper')
    });

var faxAMI = require('./lib/faxAMI');

app.set('port', config.get('port'));
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');