[concurrency-interest] Using ThreadGroup for logging

Joe Bowbeer joe.bowbeer at gmail.com
Mon Jul 24 14:08:34 EDT 2006


On 7/24/06, Mike Quilleash <mike.quilleash at subexazure.com> wrote:
>
> I have read about ThreadGroups and I have found a use for them to
> solve a problem I had.  I'd appreciate any comment on whether this
> is good/bad and whether there is a better way as I have read that
> ThreadGroups are bad, but this may just be because of stop/suspend
> etc and other dodgy statistic functions that it supports.
>

I don't see an issue with what you're doing, though we have been
trying to slowly obsolete ThreadGroup..

For an alternative, see section on "Using ThreadLocal to simplify
debug logging" in Threading Lightly, part 3:

http://www-128.ibm.com/developerworks/java/library/j-threads3.html

An InheritableThreadLocal would pass the log from parent to child.

I can't think of a great reason to switch to ThreadLocal.

--Joe


More information about the Concurrency-interest mailing list