Skip to content

Commit c81dc00

Browse files
Jony-Jasfmbenhassine
authored andcommitted
Fix inconsistent logging for step execution
Moved logger from SimpleStepHandler to AbstractStep Fixes #5279 Signed-off-by: Jony Jas J <jonyjasjonyjas@gmail.com>
1 parent c5dc0f7 commit c81dc00

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

spring-batch-core/src/main/java/org/springframework/batch/core/job/SimpleStepHandler.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2025 the original author or authors.
2+
* Copyright 2006-present the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -124,9 +124,6 @@ public StepExecution handleStep(Step step, JobExecution execution)
124124
currentStepExecution.setExecutionContext(new ExecutionContext(executionContext));
125125
}
126126

127-
if (logger.isInfoEnabled()) {
128-
logger.info("Executing step: [" + step.getName() + "]");
129-
}
130127
try {
131128
step.execute(currentStepExecution);
132129
currentStepExecution.getExecutionContext().put("batch.executed", true);

spring-batch-core/src/main/java/org/springframework/batch/core/step/AbstractStep.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2025 the original author or authors.
2+
* Copyright 2006-present the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -234,6 +234,10 @@ public final void execute(StepExecution stepExecution)
234234
.start();
235235
getJobRepository().update(stepExecution);
236236

237+
if (logger.isInfoEnabled()) {
238+
logger.info("Executing step: [" + stepExecution.getStepName() + "]");
239+
}
240+
237241
// Start with a default value that will be trumped by anything
238242
ExitStatus exitStatus = ExitStatus.EXECUTING;
239243

0 commit comments

Comments
 (0)