turned off config file reloading by default

This commit is contained in:
Gareth Jones
2011-07-27 21:21:43 +10:00
parent 4f7d73bc97
commit d13b2fb3b4
2 changed files with 6 additions and 5 deletions

View File

@@ -326,7 +326,7 @@ function initReloadConfiguration(filename, options) {
function configure (configurationFileOrObject, options) { function configure (configurationFileOrObject, options) {
var config = configurationFileOrObject; var config = configurationFileOrObject;
if (config === undefined || config === null || typeof(config) === 'string') { if (config === undefined || config === null || typeof(config) === 'string') {
options = options || { reloadSecs: 60 }; options = options || { };
if (options.reloadSecs) { if (options.reloadSecs) {
initReloadConfiguration(config, options); initReloadConfiguration(config, options);
} }

View File

@@ -418,10 +418,10 @@ vows.describe('log4js').addBatch({
} }
}, },
fakeConsole = { fakeConsole = {
'name': 'console', 'name': 'console',
'appender': function () { 'appender': function () {
return function(evt) { logEvents.push(evt); }; return function(evt) { logEvents.push(evt); };
}, },
'configure': function (config) { 'configure': function (config) {
return fakeConsole.appender(); return fakeConsole.appender();
} }
@@ -434,7 +434,7 @@ vows.describe('log4js').addBatch({
'../lib/log4js', '../lib/log4js',
{ {
requires: { requires: {
'fs': fakeFS, 'fs': fakeFS,
'./appenders/console.js': fakeConsole './appenders/console.js': fakeConsole
}, },
globals: { globals: {
@@ -444,6 +444,7 @@ vows.describe('log4js').addBatch({
} }
); );
log4js.configure(undefined, { reloadSecs: 30 });
logger = log4js.getLogger('a-test'); logger = log4js.getLogger('a-test');
logger.info("info1"); logger.info("info1");
logger.debug("debug2 - should be ignored"); logger.debug("debug2 - should be ignored");
@@ -458,7 +459,7 @@ vows.describe('log4js').addBatch({
var logEvents = args[1]; var logEvents = args[1];
assert.length(logEvents, 3); assert.length(logEvents, 3);
assert.equal(logEvents[0].data[0], 'info1'); assert.equal(logEvents[0].data[0], 'info1');
assert.equal(logEvents[1].data[0], 'info3'); assert.equal(logEvents[1].data[0], 'info3');
assert.equal(logEvents[2].data[0], 'debug4'); assert.equal(logEvents[2].data[0], 'debug4');
} }
} }