Here's how I got this to work:
The issue is that the default category for the appender config is '[all]'. Set the category to '[default]' and it will only apply to loggers that are 'gotten' with out a category: log4js.getLogger()
{
appenders: [
{ type: 'console', category: '[default]' },
{ type: 'file', filename: 'logs/cheese.log', category: 'cheese' }
]
}
More explanation:
You probably had/have something that looks like the example appender config
{
appenders: [
{ type: 'console' },
{ type: 'file', filename: 'logs/cheese.log', category: 'cheese' }
]
}
And then you get the logger by with or without a category name:
var logger = log4js.getLogger();
var cheeseLogger = log4js.getLogger('cheese');
logger.info(1)
cheeseLogger(2)
Output:
[2016-10-25 15:43:06.225] [INFO] [default] - 1
[2016-10-25 15:43:06.225] [INFO] cheese - 2
logs/cheese.log:
[2016-10-25 15:43:06.225] [INFO] cheese - 2