From a243b3f9244bcc0cdfba53351652a6c6a80ca0f0 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Thu, 9 Apr 2015 06:57:42 +0200 Subject: [PATCH] [LOGGING] Use static logger name in Engine.java To ensure subclasses like MockInternalEngine which is in a different package (test.engine) are logging under the same logger name this commit moves to a static logger class to determin the logger name. This way all subclasses of engine will log under `index.engine` which also plays nicely with `@TestLogging` where log messages sometimes disappeared since they were enabled for the `index.engine` package but not for `test.engine` --- src/main/java/org/elasticsearch/index/engine/Engine.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/elasticsearch/index/engine/Engine.java b/src/main/java/org/elasticsearch/index/engine/Engine.java index 513a13b6d43..ca7d10130ad 100644 --- a/src/main/java/org/elasticsearch/index/engine/Engine.java +++ b/src/main/java/org/elasticsearch/index/engine/Engine.java @@ -88,7 +88,8 @@ public abstract class Engine implements Closeable { this.engineConfig = engineConfig; this.shardId = engineConfig.getShardId(); this.store = engineConfig.getStore(); - this.logger = Loggers.getLogger(getClass(), engineConfig.getIndexSettings(), engineConfig.getShardId()); + this.logger = Loggers.getLogger(Engine.class, // we use the engine class directly here to make sure all subclasses have the same logger name + engineConfig.getIndexSettings(), engineConfig.getShardId()); this.failedEngineListener = engineConfig.getFailedEngineListener(); this.deletionPolicy = engineConfig.getDeletionPolicy(); }