scheduled tasks - Create job report across multiple java classes -


i implementing scheduled job needs create verbose report. report example this:

date - started job  date - looking stuff process date - got x stuff process date - processing y1 date - done date - processing y2 date - done date - processing y3 date - failed error : this_is_why_processing_failed date - processing completed date - job completed in z seconds 

the actual code doing processing can in multiple classes. obvious way implement have stringbuilder , pass around messages appended.

another more advanced approach create singleton , have id somehow known across classes take part in processing (could thread name?), , store report string there.

is there better way this? there best practices creating job reports?

the job triggered using ejb timers.

instead of passing around stringbuilder should use logger. singleton threadlocal member field place store "token" use classes working same job.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -