0

so iam trying to add an multiple logs file logging system but iam facing some errors which couldn't be read becuase of console auto close...

    log4js.configure({
        appenders: { 
            logs: { type: ['file','console'], filename: path.join(__dirname, 'logs/bot_logs.log') },
            exceptions: {  type: 'file', filename: path.join(__dirname, 'logs/bot_exceptions.log') },
            warnings: {  type: 'file', filename: path.join(__dirname, 'logs/bot_warnings.log') },
            rejections: {  type: 'file', filename: path.join(__dirname, 'logs/bot_rejections.log') }        
  },
        categories: { 
             default: { appenders: ['logs'], level: 'debug' },
             'exception': { appenders: ['exceptions'], level: 'error' },
             'warning': { appenders: ['warnings'], level: 'warning' },  
             'rejection':  { appenders: ['rejections'], level: 'fatal' }
        }
    });

    const logger = log4js.getLogger('logs');
    const excep = log4js.getLogger('exception');  
    const warni = log4js.getLogger('warning');
    const rejec = log4js.getLogger('rejection');
    logger.log(....); excep.error(.....); warni.warn(....); rejec.fatal(....);

Screenshot

Zorono
  • 75
  • 2
  • 12
  • Try to change `type: ['file','console']` to `type: 'file'` – Amiram Korach Jan 04 '18 at 13:48
  • thanks so much the problem was cuased by doing some stupid issues like this: excep.error('some text', var); instead of excep.error('some text' + var); and 'warning': { appenders: ['warnings'], level: 'warning' }, instead of 'warning': { appenders: ['warnings'], level: 'warn' }, thanks so much sir and your type: ['file','console'] instead of type: 'file' too – Zorono Jan 05 '18 at 17:36

0 Answers0