From 8831ae6e5c7721949d0c25bfc786dc343250920f Mon Sep 17 00:00:00 2001 From: Nicholas Canzoneri Date: Tue, 12 May 2015 10:33:12 -0400 Subject: [PATCH] Add index name to log statements when settings update fails When an index setting is invalid and fails to be set, a WARN statement is logged but it doesn't contain the index name, making tracking down and fixing the problem more difficult. This commit adds the index name to the log statement. --- .../metadata/MetaDataUpdateSettingsService.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java index 8b4e334bade..dd98081e021 100644 --- a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java +++ b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java @@ -85,16 +85,16 @@ public class MetaDataUpdateSettingsService extends AbstractComponent implements final int dash = autoExpandReplicas.indexOf('-'); if (-1 == dash) { - logger.warn("Unexpected value [{}] for setting [{}]; it should be dash delimited", - autoExpandReplicas, IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS); + logger.warn("failed to set [{}] for index [{}], it should be dash delimited [{}]", + IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS, indexMetaData.index(), autoExpandReplicas); continue; } final String sMin = autoExpandReplicas.substring(0, dash); try { min = Integer.parseInt(sMin); } catch (NumberFormatException e) { - logger.warn("failed to set [{}], minimum value is not a number [{}]", - e, IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS, sMin); + logger.warn("failed to set [{}] for index [{}], minimum value is not a number [{}]", + e, IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS, indexMetaData.index(), sMin); continue; } String sMax = autoExpandReplicas.substring(dash + 1); @@ -104,8 +104,8 @@ public class MetaDataUpdateSettingsService extends AbstractComponent implements try { max = Integer.parseInt(sMax); } catch (NumberFormatException e) { - logger.warn("failed to set [{}], maximum value is neither [{}] nor a number [{}]", - e, IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS, ALL_NODES_VALUE, sMax); + logger.warn("failed to set [{}] for index [{}], maximum value is neither [{}] nor a number [{}]", + e, IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS, indexMetaData.index(), ALL_NODES_VALUE, sMax); continue; } }