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.
This commit is contained in:
Nicholas Canzoneri 2015-05-12 10:33:12 -04:00
parent 91aeea9c66
commit 8831ae6e5c
1 changed files with 6 additions and 6 deletions

View File

@ -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;
}
}