batch.test('configure with dateFileAppender', (t) => {
log4js.configure({
appenders: {
date: {
type: 'dateFile',
filename: 'test/tap/date-file-test.log',
pattern: '-yyyy-MM-dd-hh-mm',
layout: { type: 'messagePassThrough' }
}
},
categories: { default: { appenders: ['date'], level: 'WARN' } }
});
const logger = log4js.getLogger('tests');
logger.info('this should not be written to the file');
logger.warn('this should be written to the file');
log4js.shutdown(() => {
fs.readFile(path.join(__dirname, 'date-file-test.log'), 'utf8', (err, contents) => {
t.include(contents, `this should be written to the file${EOL}`);
t.equal(contents.indexOf('this should not be written to the file'), -1);
t.end();
});
});
// t.teardown(() => { removeFile('date-file-test.log'); });
});
log4js version: 4.0.2
Updated from version 3.0.6 to 4.0.2 log rotation stopped working
Expected behavior
log rotation works
Actual behavior
log rotation does not work
How to reproduce
https://github.com/log4js-node/log4js-node/blob/v3.0.6/test/tap/dateFileAppender-test.js
it is enough to replace in the test configure with dateFileAppender
pattern on '-yyyy-mm-dd-hh-mm' and remove file deletion at the end
on