Skip to content

Commit ca98805

Browse files
[7.9][ML] Include cause in logging during test inference (#60749) (#60806)
When an exception is thrown during test inference we are not including the cause message in our logging. This commit addresses this issue. Backport of #60749
1 parent d39e68a commit ca98805

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/dataframe/inference/InferenceRunner.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import org.apache.logging.log4j.LogManager;
1010
import org.apache.logging.log4j.Logger;
11+
import org.apache.logging.log4j.message.ParameterizedMessage;
1112
import org.elasticsearch.action.DocWriteRequest;
1213
import org.elasticsearch.action.bulk.BulkRequest;
1314
import org.elasticsearch.action.index.IndexRequest;
@@ -87,7 +88,9 @@ public void run(String modelId) {
8788
inferTestDocs(localModel, testDocsIterator);
8889
}
8990
} catch (Exception e) {
90-
throw ExceptionsHelper.serverError("[{}] failed running inference on model [{}]", e, config.getId(), modelId);
91+
LOGGER.error(new ParameterizedMessage("[{}] Error during inference against model [{}]", config.getId(), modelId), e);
92+
throw ExceptionsHelper.serverError("[{}] failed running inference on model [{}]; cause was [{}]", e, config.getId(), modelId,
93+
e.getMessage());
9194
}
9295
}
9396

0 commit comments

Comments
 (0)