Clusterred appender should consider the categories.

It turns out that whenever the clusterred appender is used the log event is passed to all actual appenders.
The actual appender's category is ignored.

Signed-off-by: Vladimir Mitev <idalv@users.noreply.github.com>
This commit is contained in:
Vladimir Mitev 2014-05-20 13:45:46 +03:00
parent ca5272aacc
commit 2daf29b400

View File

@ -71,10 +71,13 @@ function createAppender(config) {
if (config.actualAppenders) { if (config.actualAppenders) {
var size = config.actualAppenders.length; var size = config.actualAppenders.length;
for(var i = 0; i < size; i++) { for(var i = 0; i < size; i++) {
if (!config.appenders[i].category || config.appenders[i].category === loggingEvent.categoryName) {
// Relying on the index is not a good practice but otherwise the change would have been bigger.
config.actualAppenders[i](loggingEvent); config.actualAppenders[i](loggingEvent);
} }
} }
} }
}
// Listen on new workers // Listen on new workers
cluster.on('fork', function(worker) { cluster.on('fork', function(worker) {