I'm wanting to know how to log things such as the Job Name
and Execution ID
using MCD in Spring Batch.
Here's some code:
bootstrap.properties
this file has a list of items I currently log, and I've added execId
as the 3rd element here.
logging.pattern.level=%5p [%X{X-B3-TraceId:-},%X{sessionId:-},%X{execId:-},%X{program:-},%X{mainframeId:-}]
spring.application.name=mcc
spring.profiles.active=globals,local,local-override
MCC Application
this file has my main method. When I manually set the field here with MDC.put("execId", "12345");
I see it in the log, but I don't understand how to put the actual information I need here.
@SpringBootApplication(exclude = {SecurityAutoConfiguration.class, ManagementWebSecurityAutoConfiguration.class})
public class MccApplication {
public static void main(String[] args) {
MDC.put("execId", "12345");
SpringApplication.run(MccApplication.class, args);
}
}
I would appreciate any insight :) Thank you.