Add log4js config setting

pull/1353/head
Marcel Klehr 2013-01-13 12:20:49 +01:00
parent 2786807f2f
commit f4b95c5ca4
6 changed files with 21 additions and 8 deletions

View File

@ -11,8 +11,7 @@ if(process.argv.length != 3)
var padId = process.argv[2];
//initalize the database
var log4js = require("../src/node_modules/log4js");
log4js.setGlobalLogLevel("INFO");
var settings = require("../src/node/utils/Settings");
var async = require("../src/node_modules/async");
var db = require('../src/node/db/DB');

View File

@ -10,13 +10,11 @@ if(process.argv.length != 3)
//get the padID
var padId = process.argv[2];
var db, dirty, padManager, pad;
var db, dirty, padManager, pad, settings;
var neededDBValues = ["pad:"+padId];
var npm = require("../src/node_modules/npm");
var async = require("../src/node_modules/async");
var log4js = require("../src/node_modules/log4js");
log4js.setGlobalLogLevel("INFO");
async.series([
// load npm
@ -35,6 +33,7 @@ async.series([
},
// load modules
function(callback) {
settings = require('../src/node/utils/Settings');
db = require('../src/node/db/DB');
dirty = require("../src/node_modules/ueberDB/node_modules/dirty")(padId + ".db");
},

View File

@ -2,6 +2,7 @@ require("ep_etherpad-lite/node_modules/npm").load({}, function(er,npm) {
process.chdir(npm.root+'/..')
var settings = require("ep_etherpad-lite/node/utils/Settings");
var dirty = require("ep_etherpad-lite/node_modules/ueberDB/node_modules/dirty")('var/dirty.db');
var db = require("ep_etherpad-lite/node/db/DB");

View File

@ -47,6 +47,13 @@
},
*/
//Logging configuration. See log4js documentation for further information
// https://github.com/nomiddlename/log4js-node
"logconfig" :
{ "appenders": [
{ "type": "console" }
] },
//the default text of a pad
"defaultPadText" : "Welcome to Etherpad Lite!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\n\nGet involved with Etherpad at http:\/\/etherpad.org\n",

View File

@ -25,7 +25,6 @@ var log4js = require('log4js')
, async = require('async')
;
// set up logger
log4js.replaceConsole();
var settings
@ -50,8 +49,6 @@ async.waterfall([
hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks");
hooks.plugins = plugins;
//set loglevel
log4js.setGlobalLogLevel(settings.loglevel);
callback();
},

View File

@ -25,6 +25,7 @@ var path = require('path');
var argv = require('./Cli').argv;
var npm = require("npm/lib/npm.js");
var vm = require('vm');
var log4js = require("log4js");
/* Root path of the installation */
exports.root = path.normalize(path.join(npm.dir, ".."));
@ -106,6 +107,11 @@ exports.abiword = null;
*/
exports.loglevel = "INFO";
/*
* log4js appender configuration
*/
exports.logconfig = { appenders: [{ type: "console" }]};
/* This setting is used if you need authentication and/or
* authorization. Note: /admin always requires authentication, and
* either authorization by a module, or a user with is_admin set */
@ -173,6 +179,10 @@ exports.reloadSettings = function reloadSettings() {
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.dbType === "dirty"){
console.warn("DirtyDB is used. This is fine for testing but not recommended for production.")