Thursday, 11 May 2017

How to set different levels in Log4JS for appenders?

Currently my config looks like this:

log4js.configure({
    appenders: [
        {
            type: 'dateFile',
            filename: path.join(config.path.root, 'logs/log.log'),
            pattern: '-yyyy-MM-dd',
            alwaysIncludePattern: true,
            category: 'category1'
        },
        {
            type: 'console',
            category: 'category2'
        }
    ],
    levels: {'category1': 'ALL', 'category2': 'DEBUG'}
})

Basically I want to see everything in file and only info in console. Currently it doesn't show anything. If I remove category properties from appenders it shows same in both appenders



via Kin

No comments:

Post a Comment