Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

watchLog option does not work #363

Open
nullromo opened this issue Nov 22, 2022 · 0 comments
Open

watchLog option does not work #363

nullromo opened this issue Nov 22, 2022 · 0 comments

Comments

@nullromo
Copy link
Contributor

nullromo commented Nov 22, 2022

Code Excerpt

const fileTransportOptions: DailyRotateFileTransportOptions = {
    dirname: path.resolve(DATA_DIRECTORY, 'logs'),
    extension: '.log',
    filename: 'server-%DATE%',
    format: winston.format.combine(
        winston.format.timestamp({
            format: TIMESTAMP_FORMAT,
        }),
        winston.format.uncolorize(),
        winston.format.json(),
        winston.format.printf((info) => {
            info.message = (info.message as string).trim();
            return JSON.stringify(info);
        }),
    ),
    json: true,
    maxFiles: '30d',
    watchLog: true, // <=========================== important part here
};
const fileTransport = new DailyRotateFile(fileTransportOptions);

Steps

Run the code with the options above. Delete the log file while it's running.

Expected Behavior

The file should be regenerated and the logging should continue after the file is deleted.

Actual Bahavior

The file is not regenerated. I must restart my code for the log file to come back.

System Details

winston version: 3.7.2
winston-daily-rotate-file version: 4.6.1
winston-transport version: 4.5.0
system: WSL 2
node version: 18.7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant