I think that you could use something like:

PatternLayout pattern = new PatternLayout("your pattern");
String filename = <some file name based on thread name>;
FileAppender  threadAppender = new FileAppender(pattern, filename);
String threadLogName = <some log name derived from thread name>;
Logger threadLog = Logger.getLogger(threadLogName);
threadLog.setAdditivity(false);
threadLog.addAppender(threadLog);

Michael Giroux

On 10/11/06, sudhakardvvn <[EMAIL PROTECTED]> wrote:

Have an application where the number of threads that get launched are
dynamic.  Could be anywhere from 1 to 300 threads that could get launched at
runtime.  I would like to know if it is possible to setup a file appender
for each thread and have the indiv threads write to their own file appender.
Currently all threads write to one log file using 1 file appender in a
log4j.properties file but would like ability for each thread to log its own
messages for easier debugging. Any good sites or source would be great. Any
help would be appreciated.

--
View this message in context: 
http://www.nabble.com/logging-into-different-files-tf2422885.html#a6754850
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to