Hello Christian,
Thank you for taking the time to write a test case reproducing the problem. As
it stands, the problem arises from the fact that the two file appenders share
the same layout which is incorrect. Layouts are not meant to be shared.
HTH,
Christian Delbe wrote:
Hi,
I encountered a synchronization issue with log4j 1.2.15 : if two threads
write into 2 loggers that are plugged into 2 FileAppenders, the two
resulting files are mixed up...
Here is the code of my simple test. The problem is that at the end of
the execution, the file "log1" contains some lines "MESSAGE FOR
logger2", and conversely.
[snip]
FileAppender fa1 = new FileAppender(Log4JTaskLogs.DEFAULT_LOG_LAYOUT,
<-- here
"/user/cdelbe/home/tmp/log1",false);
l1.addAppender(fa1);
FileAppender fa2 = new FileAppender(Log4JTaskLogs.DEFAULT_LOG_LAYOUT,
<-- and here
"/user/cdelbe/home/tmp/log2",false);
l2.addAppender(fa2);
} catch (IOException e) {
e.printStackTrace();
}
[snip]
Christian.
--
Ceki Gülcü
The complete log4j manual: http://www.qos.ch/log4j/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]