0

I need to log statements something like below , in which the log statement consist of some custom values configured. I am using logging in context of spring batch. So i would like to differentiate log statements by the jobs running. Example job1 and job2 are running in parallel so the logs should appear something like ,

 2015-08-31 19:14:34 DEBUG Main:23 - [Job1]:testing msg 1
 2015-08-31 19:14:35 DEBUG Main:28 - [Job2]:testing msg 2
2015-08-31 19:14:34 DEBUG Main:23 - [Job2]:testing msg 1
 2015-08-31 19:14:35 DEBUG Main:28 - [Job1]:testing msg 2
2015-08-31 19:14:34 DEBUG Main:23 - [Job1]:testing msg 1
 2015-08-31 19:14:35 DEBUG Main:28 - [Job2]:testing msg 2

I checked considering MDC - org.slf4j.MDC but seems will not help differentiating logs by jobs.

Please help , thanks in advance !

0 Answers0