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
Post a Comment