parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

ParseServer maxLogFiles not yet effective ?

Open zurmokeeper opened this issue 7 months ago • 3 comments

New Issue Checklist

Issue Description

var api = new ParseServer({
    // logLevel:"error",
    databaseURI: database.uri,
    cloud: server.cloud,
    appId: server.appId,
    masterKey: server.masterKey,
    serverURL: Config.server.serverURL,
    directAccess: false,
    maxLogFiles: 5
});

maxLogFiles not yet effective ????

I specified the maximum number of log files as 5, but the number of generated files still exceeds 5, I read the configuration of winston, it is necessary to use with maxsize, in the exceeding of maxsize will automatically delete the log files before 5. But I read the source code of winston and parse-server configurations, and this maxLogFiles configuration is not correct to be used in winston in the end.

parse-server source code: 

const consoleFormat = options.json ? format.json() : format.simple();
const consoleOptions = Object.assign(
  {
    colorize: true,
    name: 'console',
    silent,
    format: format.combine(format.splat(), consoleFormat),
  },
  options
);

transports.push(new winston.transports.Console(consoleOptions));    // maxLogFiles ->maxFiles  This configuration winston is not for here.
}

logger.configure({
   transports,
});
winston  example: 

const logger = winston.createLogger();
logger.configure({
        level: 'verbose',
        transports: [
            new winston.transports.File({
                filename: path.join(__dirname, 'info.log'),
                // level: 'info',
                // maxsize: 1024,
                maxFiles: 2           //  It should be in the` File `configuration, not the` Console `configuration.
            })
        ]      
})

Steps to reproduce

Actual Outcome

Expected Outcome

Environment

Server

  • Parse Server version: v6.3.1
  • Operating system: windows

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 5.0

Logs

zurmokeeper avatar Nov 29 '23 03:11 zurmokeeper