Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/136709.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 136709
summary: Fix log formatting in `SnapshotLifecycleTask`
area: ILM+SLM
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,9 @@ public void onFailure(Exception e) {
@Override
public void onFailure(Exception e) {
SnapshotHistoryStore.logErrorOrWarning(
logger,
clusterService.state(),
() -> format("failed to create snapshot for snapshot lifecycle policy [{}]", policyMetadata.getPolicy().getId()),
() -> format("failed to create snapshot for snapshot lifecycle policy [%s]", policyMetadata.getPolicy().getId()),
e
);
final long timestamp = Instant.now().toEpochMilli();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,15 @@ public void putAsync(SnapshotHistoryItem item) {
);
},
exception -> logErrorOrWarning(
logger,
clusterService.state(),
() -> format("failed to index snapshot history item in data stream [%s]: [%s]", SLM_HISTORY_DATA_STREAM, item),
exception
)
));
} catch (IOException exception) {
logErrorOrWarning(
logger,
clusterService.state(),
() -> format("failed to index snapshot history item in data stream [%s]: [%s]", SLM_HISTORY_DATA_STREAM, item),
exception
Expand All @@ -103,7 +105,7 @@ public void putAsync(SnapshotHistoryItem item) {
}

// On node shutdown, some operations are expected to fail, we log a warning instead of error during node shutdown for those exceptions
public static void logErrorOrWarning(ClusterState clusterState, Supplier<?> failureMsgSupplier, Exception exception) {
public static void logErrorOrWarning(Logger logger, ClusterState clusterState, Supplier<?> failureMsgSupplier, Exception exception) {
if (PluginShutdownService.isLocalNodeShutdown(clusterState)) {
logger.warn(failureMsgSupplier, exception);
} else {
Expand Down