logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adrian Janssen" <a.jans...@videonetworks.com>
Subject RE: Logging multiple threads to multiple files
Date Mon, 17 Nov 2003 09:34:23 GMT
How did you attempt the loggers per thread approach?

As far as I can see this should be possible. If you create 5 different
loggers, 1 per thread and make sure that they all descend from the root and
the additivity is set to false. Then store the logger objects in a
java.lang.ThreadLocal object so that each thread will only pick up its own
logger.

-----Original Message-----
From: Adrian Janssen
Sent: 14 November 2003 20:12
To: Log4J Users List
Subject: RE: Logging multiple threads to multiple files


No, I've tried that before. I ended up with 5 log files sharing the same
output.

Ed

"Sullivan, Sean C - MWT" <Sullivan.Sean@menlolog.com> wrote:

Can you create a unique Logger object for each thread?

Thread1 would use a Logger called "Thread1Logger"

Thread2 would use a Logger called "Thread2Logger"

etc

-Sean


> -----Original Message-----
> At 10:19 AM 11/14/2003 -0800, wrote:
> >I'm using log4j 1.2.8. I have a class that starts off 4 other threads. So
> >I have 5 threads running, all at the same time. What I would like to do
> is
> >log the 5 threads into their own log files.
> >
> >The first time I tackled this, I got 5 files with the same output (all
> >output from all threads). Then I got it to where the 5 files show
> >different things, however, it seems like the threads are stepping over
> >each other. thread1 would have a log entry in thread2's log, thread2's
> log
> >will have some entries in thread3's log, and so on.
> >
> >I've done some poking around and found that I can set a threshhold to log
> >specific log levels to different files, but that's not what I need. I
> want
> >to log ALL levels from a thread to its own log file.
> >
> >Can this even be done?
>

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


---------------------------------
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Mime
View raw message