Added log rolling to config files

This commit is contained in:
csausdev
2010-12-06 18:23:43 +11:00
parent 75b9e82cac
commit 966b8ced4f
4 changed files with 26 additions and 8 deletions

View File

@@ -186,7 +186,10 @@ vows.describe('log4js').addBatch({
},
readFileSync: function(file, encoding) {
return require('fs').readFileSync(file, encoding);
}
},
watchFile: function(file) {
messages.watchedFile = file;
}
},
log4js = require('../lib/log4js')(fakeFS);
return [ log4js, messages ];
@@ -220,7 +223,13 @@ vows.describe('log4js').addBatch({
assert.length(messages['tmp-tests-warnings.log'], 2);
assert.deepEqual(messages['tmp-tests.log'], ['main\n','both\n','both\n','main\n']);
assert.deepEqual(messages['tmp-tests-warnings.log'], ['both\n','both\n']);
}
},
'should handle fileAppender with log rolling' : function(args) {
var log4js = args[0], messages = args[1];
delete messages['tmp-test.log'];
log4js.configure('test/with-log-rolling.json');
assert.equal(messages.watchedFile, 'tmp-test.log');
}
},
'with no appenders defined' : {

View File

@@ -0,0 +1,11 @@
{
"appenders": [
{
"type": "file",
"filename": "tmp-test.log",
"maxLogSize": 1024,
"backups": 3,
"pollInterval": 15
}
]
}