简体   繁体   中英

Separate log file per job execution

I have a batch process(Spring batch), I want to create separate log file per batch execution, so that it will be easy for us to debug the entire flow using this single log file. Is there a way to achieve it. We are using log4j for logging across .

I think you can store dynamic log file name as a job parameter or into execution context and set log4j filename programmatically like described here using a JobExecutionListener .
I don't know how achive the same goal using log4j XML config and log4j properties substitution because I have never used log4j too much.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM