From 2daf29b400e796c8414cb648994ccc4af4e57ece Mon Sep 17 00:00:00 2001 From: Vladimir Mitev Date: Tue, 20 May 2014 13:45:46 +0300 Subject: [PATCH] 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 --- lib/appenders/clustered.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/appenders/clustered.js b/lib/appenders/clustered.js index aae3a4c..b427ab6 100755 --- a/lib/appenders/clustered.js +++ b/lib/appenders/clustered.js @@ -71,7 +71,10 @@ function createAppender(config) { if (config.actualAppenders) { var size = config.actualAppenders.length; for(var i = 0; i < size; i++) { - config.actualAppenders[i](loggingEvent); + 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); + } } } }