简体   繁体   English

每个作业执行的独立日志文件

[英]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. 我有一个批处理过程(Spring批处理),我想为每个批处理执行创建单独的日志文件,以便我们可以轻松地使用此单个日志文件调试整个流程。 Is there a way to achieve it. 有没有办法实现它。 We are using log4j for logging across . 我们正在使用log4j进行跨日志记录。

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 . 我认为您可以将动态日志文件名存储为作业参数或存储到执行上下文中,并使用JobExecutionListener此处所述那样以编程方式设置log4j文件名。
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. 我不知道使用log4j XML配置和log4j属性替换如何达到相同的目标,因为我从未过多使用log4j。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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