Testing size-based rotation, doesn't seem to work as expected
envgap__log4js-node__log4js-node-911
01 / FAILURE SIGNATURE
As reported upstream
logger.error(new Error('bad thing 1'));Not a benchmark task.
- The project already builds and runs before the fix, so there is nothing to repair.
02 / ENVIRONMENT RECIPE
- Base commit
060ce64158b05a288873aa502ede8b5ca4f5824c- Manifest
package.json- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
log4js-node/log4js-node #911 · read the original issue
I'm still running tests on log4js assessing it's viability as a replacement for the no longer maintained bunyan.
I just did a very very basic test on size-based rotation, and I'm not seeing the behaviour I'd expect.
Here's my test code:
```
const log4js = require('log4js');
const config = {
appenders: {
access: {type: 'file', filename: 'logs/test.log', maxLogSize: 5000, backups: 4}
},
categories: {default: {appenders: ['access'], level: 'debug'}}
};
log4js.configure(config);
const logger = log4js.getLogger('default');
logger.info('hello world 1');
logger.error(new Error('bad thing 1'));
logger.info('hello world 2');
logger.error(new Error('bad thing 2'));
```
This file is saved as `logging.js` and I'm hammering `node logging.js` locally on my macbook pro. I'm expecting there to quickly be 10 files, but there are never more than 2.
If I duplicate my log lines at the bottom so much more log content is output, I can get 10 files to be created, but never from consistently hitting the script.
I thought it might be related to this bug, because outputting more content in one stream/session creates more files: https://github.com/log4js-node/streamroller/issues/34 - but it seems to be entirely to do with the number of backup files created, not the size of the individual files.
I'm looking for file size based rotation, not date based rotation, due the sheer volume of log files I'm going to be using this with - rotating all the log files across 1000s of apps at midnight causes performance problems 😬
04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]