How to use the log4js.consoleAppender 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.length >= 1) {
    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 sivy / node-short / app.js View on Github external
var settings = require('./settings'),
    UrlProvider = require('./urlprovider-mongo').UrlProvider,
//    UserProvider = require('./urlprovider-memory').UserProvider,
    sys = require('sys'),
    template = require('./template/template'),
    loader = require('./template/loader'),
    admin = require('./admin');

loader.set_path(settings.template_path);

/*
 * LOGGING SUPPORT
 */
var log4js = require('log4js');
log4js.addAppender(log4js.consoleAppender(), 'app');
log4js.addAppender(log4js.consoleAppender(), 'resolved');
log4js.addAppender(log4js.consoleAppender(), 'defer_queue');

app_log = log4js.getLogger('app');
app_log.setLevel('TRACE');

resolved_log = log4js.getLogger('resolved');
resolved_log.setLevel('TRACE');

defer_log = log4js.getLogger('defer_queue');
defer_log.setLevel('TRACE');

// error handling
function handleError(error, res) {
    app_log.error(error.message);
    app_log.debug(JSON.stringify(error));
github mozilla / sauropod / srv / configuration / index.js View on Github external
# ***** END LICENSE BLOCK *****
*/

//  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',