diff --git a/bin/checkPad.js b/bin/checkPad.js index a46c1814..a92f836c 100644 --- a/bin/checkPad.js +++ b/bin/checkPad.js @@ -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'); diff --git a/bin/extractPadData.js b/bin/extractPadData.js index f79b964a..ea00f953 100644 --- a/bin/extractPadData.js +++ b/bin/extractPadData.js @@ -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"); }, diff --git a/bin/migrateDirtyDBtoMySQL.js b/bin/migrateDirtyDBtoMySQL.js index d0273de0..b4913e76 100644 --- a/bin/migrateDirtyDBtoMySQL.js +++ b/bin/migrateDirtyDBtoMySQL.js @@ -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"); diff --git a/settings.json.template b/settings.json.template index e37bc450..04c09751 100644 --- a/settings.json.template +++ b/settings.json.template @@ -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", diff --git a/src/node/server.js b/src/node/server.js index 327fa166..db75d7e3 100755 --- a/src/node/server.js +++ b/src/node/server.js @@ -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(); }, diff --git a/src/node/utils/Settings.js b/src/node/utils/Settings.js index bed5a9a0..8435ab2c 100644 --- a/src/node/utils/Settings.js +++ b/src/node/utils/Settings.js @@ -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.")