Shard state action request logging

This commit modifies the string representation of a shard state action
request. The issue being addressed is that the previous logging would
log "failure: [Unknown]" for shard started actions but this just leads
to confusion that there is a failure but its cause is unknown.

Closes #16396
This commit is contained in:
Jason Tedor 2016-02-02 21:32:14 -05:00
parent 20b584c7e1
commit 0b474c6cfc

View File

@ -435,13 +435,14 @@ public class ShardStateAction extends AbstractComponent {
@Override
public String toString() {
return String.format(
Locale.ROOT,
"failed shard [%s], source shard [%s], message [%s], failure [%s]",
shardRouting,
sourceShardRouting,
message,
ExceptionsHelper.detailedMessage(failure));
List<String> components = new ArrayList<>(4);
components.add("failed shard [" + shardRouting + "]");
components.add("source shard [" + sourceShardRouting + "]");
components.add("message [" + message + "]");
if (failure != null) {
components.add("failure [" + ExceptionsHelper.detailedMessage(failure) + "]");
}
return String.join(", ", components);
}
}