Example: 2 applications (sender/receiver) exchanging requests and replies. How does the sender flag a specific request to be traced or tracked across both applications at runtime?
Well, today java developers who use log4j or any other logging framework would enable debug (you also need to know what categories to be debug enabled) on both applications and you get all kinds of messages in the log. Now you have to analyze the log and pick out entries that are only related to a set of specific request/reply pairs relevant to a specific exchange of interest.
TNT4J provides a facility to share context across applications called shared conditional logging. The idea is to establish a shared pool of tokens (key/value pairs) available to all applications a runtime. These tokens can be added, removed, updated on the fly and therefore logging context or any other context can be communicated to all applications at runtime.
This simple model allows
sender applications set a token/value pair and pass it along (out of band) to
the receiver. Both apps can check for trace levels on a specific token to
determine whether logging is needed. The result is that only specific
request/reply pairs are tracked across 2 or more applications.
This approach saves
developer a ton of time, reduces the overhead associated with enabling debug
mode for all, logs only what is needed and therefore reduces the amount of
manual analysis, simplifies diagnostics phase.
I am using this framework in my own project and so far with great results.