← All tasks
javascriptlog4js-node/log4js-node #838Not a task: already works

Log rotation does not work

envgap__log4js-node__log4js-node-838

01 / FAILURE SIGNATURE

As reported upstream

No identifying execution failure has been captured.
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
edc1d2b3bd771b5df960c4268f51764e2dc5aaca
Manifest
package.json
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

log4js-node/log4js-node #838 · read the original issue
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



```

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'); });

  });

```

Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]