How to use the log4js.fileAppender 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 mozilla / sauropod / srv / main.js View on Github external
if (args[0] == "mock") {
	verifyFunc = dummyVerifyBrowserID;
	conf = args[1];
    } else {
	conf = args[0];
    }
}

var https = require('https');
var uuid = require('node-uuid');
var express = require('express');

var log4js = require('log4js');
var url = require('url');
log4js.addAppender(log4js.consoleAppender());
log4js.addAppender(log4js.fileAppender('logs/sauropod.log'), 'sauropod');

var connect = require('connect');
console.log('Using the "' + conf + '" config');
var config = require('./configuration').getConfig(conf);
var logger = config.logger;
logger.info('Using the "' + conf + '" config');

console.log('Using the "' + config.storage.backend + '" storage backend');
var storage = require(config.storage.backend);

var sauropod = express.createServer(); // TODO: Transition to HTTPS server
sauropod.use(connect.logger('short'));
sauropod.use(express.bodyParser());
sauropod.use(express.cookieParser());
sauropod.use(express.session({secret: 'apatosaurus'}));
github cliffano / couchtato / lib / report.js View on Github external
var log4js = require('log4js'),
    logger = log4js.getLogger('couchtato');

if (process.env.COUCHTATO_LOG === 'OFF') {
    log4js.clearAppenders();
} else {
    log4js.addAppender(log4js.fileAppender('couchtato.log'), 'couchtato');
}

var Report = function () {
    this.successes = [];
    this.errors = [];
    this.counts = {};
};
Report.prototype.start = function (date, url) {
    this.startDate = date;
    logger.info('================================================');
    logger.info('Couchtato is relaxed...');
    logger.info('Using database URL ' + url);
};
// keep nextTick-ing until all calls are completed
Report.prototype._finish = function (calls) {
    var that = this;
github mozilla / sauropod / srv / configuration / index.js View on Github external
*/

//  Configuration loader for Sauropod.
//  This module lets you load a named config like "dev" or "prod" by
//  doing:
//
//    var config = configuration.getConfig("dev");
//
//  Behind the scenes, this loads the module "configuration/dev.js",
//  merged it with some default configuration options, and returns the
//  resulting object.

const os = require('os');
const log4js = require('log4js');
log4js.addAppender(log4js.consoleAppender());
log4js.addAppender(log4js.fileAppender('logs/sauropod.log'), 'sauropod');


// Like $.extend from jQuery, but recursive.
// This is useful for deep cloning properties from multiple objects.
// We use it to merge config files with the default settings.
//
function deep_extend() {
    //  The first argument is the object to extend.
    //  It gets extended by the properties of all other arguments in turn.
    var obj = arguments[0];
    for (var i=1; i
github mozilla / sauropod / srv / configuration.js View on Github external
const os = require('os');
const log4js = require('log4js');
log4js.addAppender(log4js.consoleAppender());
log4js.addAppender(log4js.fileAppender('logs/sauropod.log'), 'sauropod');

var config = {};

var dev = {};
try {
    dev = require('./dev-config').config;
    console.log('Using custom dev config module');
} catch (e) {
    dev = {
	serve: { listen: 8001 },
	storage: {
	    //hosts: ['appsync-hbase-stage1', 'appsync-hbase-stage2'],
	    host: 'localhost',
	    port: 9090,
	    backend: './storage-thrift',
	},
github azer / lowkick / lib / logging.js View on Github external
function filename(uri){
  logger.info('Adding "%s" as a file appender to the logger.', uri);
  log4js.addAppender(log4js.fileAppender(uri));
}