 <p>In case you're using log4j breed of logging APIs you might be interested in looking at MDC - <a href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/MDC.html" rel="nofollow noreferrer">mapped diagnostic context</a>. It was designed particularly for this type of problems. Check out <a href="http://www.moonlit-software.com" rel="nofollow noreferrer">logFaces</a> - it will let you <a href="http://www.moonlit-software.com/logfaces/web/features/index.php#mdc" rel="nofollow noreferrer">easily fish out</a> particular context data in real time or by doing queries. Otherwise, the ThreadLocal mentioned by Aaron seems reasonable too, it's just that you will have to do the coding yourself instead of using proved concept of MDC used in log4j for a long time and by many users.</p> <p><strong>Disclosure</strong>: I am the author of this product.</p>