Winston does not write file

Hello everybody. I have a problem - not writing to the file. The recording is done by winston. I test it on the server of my computer - everything is ok. I upload it here - the file is not written. The rights to the file were added by 777.
Here is the code:

const options = {
    fileInfo: {
        level: 'info',
        filename: `${appRoot} / info.txt`,
        handleExceptions: true,
        json: true,
        maxsize: 5242880, // 5MB
        maxFiles: 5,
        colorize: true,
    }
};
// instantiate a new Winston Logger with the settings defined above
const logger = new winston.createLogger ({
    transports: [
        new winston.transports.File (options.fileInfo)
    ],
    exitOnError: false, // do not exit on handled exceptions
});
// create a stream object with a 'write' function that will be used by `morgan`
logger.stream = {
    write: function (message, encoding) {
        logger.info (message);
    }
};

Please help me figure it out.

What is the value of ${appRoot} and have you tried setting the file name to just info.txt? Are you getting any sort of error message?

1 Like

${appRoot} - path to the file.
const appRoot = require ('app-root-path');
I do not receive any error messages, I looked at the logs.

I’ll try to remove $ {appRoot}

Used the path without ${appRoot}, everything works.
Thanks a lot for your help!