How to use the log4js.configure 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 Hugo-ter-Doest / chart-parsers / spec / TypedFeatureStructure_spec.js View on Github external
the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see .
*/

var settings = require('../config/Settings');

var log4js = require('log4js');
log4js.configure(settings.log4js_config);
var logger = log4js.getLogger('TypedFeatureStructure');
var fs = require('fs');

var signatureParser = require('../lib/SignatureParser');
var lexiconParser = require('../lib/LexiconParser');
var TypeLattice = require('../lib/TypeLattice');
var Type = require('../lib/Type');

var base = './spec/data/TypedFeatureStructure/';

var signatureFile = base + 'TFS_Signature.txt';
var featureStructureFile = base + 'TFS_Lexicon.txt';

// For selecting tests from the lexicon
var ignoreFilter = true;
// A list of results that must be tested
github ibm-watson-iot / blockchain-samples / contracts / advanced / iot_sample_contract_e2e_tests / logger.js View on Github external
function createLogger(logToMemoryOnly, numEntries, loggerName, config) {
    var that = {};
    var size = numEntries || 20;
    var history = new Array(size);
    var index = 0;
    
    if(config != undefined){
    	 log4js.configure(config);
    }
   
    var log4jsLogger = log4js.getLogger(loggerName);
    
    
    that.logger = log4jsLogger;
    var memoryOnly = false;
	var formatEntry = function(entry) {
		var result = "";
		if (entry) {
			result += entry.time.toISOString() + " " + entry.msg + "\n";
		}
		return result;
	};
	
    var log = function(msg) {
github karma-runner / karma / lib / logger.js View on Github external
if (appender.type === 'console') {
          appenders['console'] = appender
          if (helper.isDefined(appender.layout) && appender.layout.type === 'pattern') {
            appender.layout.pattern = pattern
          }
        } else {
          appenders[index + ''] = appender
        }
        return appender
      })
    }
  } else {
    appenders = { 'console': constant.CONSOLE_APPENDER }
  }

  log4js.configure({
    appenders: appenders,
    categories: {
      'default': {
        'appenders': Object.keys(appenders),
        'level': level
      }
    }
  })
}
github xiaolulu / upopen / serverES6 / lib / loger.js View on Github external
'category': 'file',
			'filename': '/file.log',
			'maxLogSize': 1024*1028*10,		
			'backups': 10
		}
	],
	replaceConsole: true,
	'levels':{
		'console':'all',
		'file': 'all',
		'info': 'all',
		'warn': 'warn'
	} 
}

log4js.configure( config, { cwd: `${path}`} );

const logFile = log4js.getLogger( 'file' );
const logInfo = log4js.getLogger( 'info' );
const logWarn = log4js.getLogger( 'warn' );

export {
	logFile,
	logInfo,
	logWarn
};
github salimkayabasi / types-checker / src / cli.js View on Github external
.parse(process.argv);

const options = {
  log: program.logger || false,
  noColor: program.noColor || false,
  install: program.install || false,
  error: program.error || false,
  interactive: program.interactive || false,
  useNpm: program.useNpm || false,
  cwd: program.path || process.cwd(),
  devDependencies: program.devDependencies || false,
};

chalk.enabled = !options.noColor;

log4js.configure({
  appenders: {
    out: {
      type: 'stdout',
      layout: {
        type: 'messagePassThrough',
      },
    },
  },
  categories: {
    default: {
      appenders: ['out'],
      level: options.log ? 'debug' : 'info',
    },
  },
});
github tzbcf / myblog-vue.cli-3.0-node-ts / servers / lib / logger.ts View on Github external
constructor() { 
        this.logConfig = logConfig;
        this.initLogPath();
        log4js.configure(this.logConfig);
        this.resLogger = log4js.getLogger("resLogger");
        this.errorLogger = log4js.getLogger("errorLogger");
        this.resLogger = log4js.getLogger();
    };
    initLogPath():void{
github trasukg / local-aprs / server / server.js View on Github external
function loggingIsDoneThroughLog4js() {
  log4js.configure('log-config.json');
  logger.debug("logging system has been setup.");
}
github joshsoftware / peerly / node-backend / app / logger / loggerConfig.js View on Github external
const log4js = require("log4js");

const getLoggerFileCompression = () => {
  if (process.env.LOGGER_FILE_COMPRESSION == "false") {
    return false;
  } else {
    return true;
  }
};

module.exports = log4js.configure({
  appenders: {
    fileAppender: {
      type: process.env.TYPE_OF_LOGGER_FILE,
      pattern: process.env.LOGGER_ROLLING_TYPE,
      compress: getLoggerFileCompression(),
      filename: process.env.LOGGER_FILE_STORAGE_PATH,
      daysToKeep: parseInt(process.env.BACKUP_FILES_FOR_LOGGER),
    },
  },
  categories: {
    default: {
      appenders: ["fileAppender"],
      level: ["ALL"],
    },
  },
});
github zce / electron-boilerplate / app / libraries / logger.js View on Github external
import log4js from 'log4js'
import config from './config'

log4js.configure({
  appenders: [{ type: 'console' }].concat(config.log4js)
})

export const main = log4js.getLogger('main')
export const renderer = log4js.getLogger('renderer')
github lersh / potatoStream / potatoSocks5.js View on Github external
'use strict';
const socks = require('socks-proxy');
const net = require('net');
const tls = require('tls');
const crypto = require('crypto');
const fs = require('fs');
const PotatoLib = require('./lib/potato');
const Obfs = require('./lib/obfs');

//log4js module
var log4js = require('log4js');
var logConfig = require('./logConfig.json');
log4js.configure(logConfig);
var logger = log4js.getLogger('client');
//读取配置文件
var config = require('./config.json');

var
	algorithm = 'aes-256-cfb',
	password = '';

//设定加密算法和密码
if (config.algorithm != null)
	algorithm = config.algorithm;
if (config.password != null)
	password = config.password;

var Potato = new PotatoLib(algorithm, password);
var EncryptStream = Potato.EncryptStream;