I am getting Error: Problem with log4js configuration: ({ appenders:
[ { type: 'logLevelFilter',
level: 'INFO',
appenders: { type: 'console' } } ] }) - must have a property "appenders" of type object.
My protractor.conf.js file snippet:
beforeLaunch:function(){
log4js.configure({
appenders:
[{ type: 'log4js-protractor-appender',
category: 'protractorLog4js' },
{
type: "file",
filename: './logs/ExecutionLog.log',
category: 'protractorLog4js'
}
]
});
},
I am not sure why i am getting this error even though there is appenders in the conf.
log4js-node in version 1.x using format like yours:
appenders:[] // Array
but Object in version 2.x like this:
appenders: {
cheeseLogs: { type: 'file', filename: 'cheese.log' },
console: { type: 'console' }
},
categories: {
cheese: { appenders: ['cheeseLogs'], level: 'error' },
another: { appenders: ['console'], level: 'trace' },
default: { appenders: ['console', 'cheeseLogs'], level: 'trace' }
}
https://github.com/nomiddlename/log4js-node
In the new version your appenders would look like this:
appenders: {
fileLog: { type: 'file', filename: './logs/ExecutionLog.log' },
console: { type: 'log4js-protractor-appender' }
},
categories: {
file: { appenders: ['fileLog'], level: 'error' },
another: { appenders: ['console'], level: 'trace' },
default: { appenders: ['console', 'fileLog'], level: 'trace' }
}
Configuration format changed in version 2.x
https://github.com/nomiddlename/log4js-node/issues/500