logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Delbe <christian.de...@activeeon.com>
Subject Re: Synchronisation issue with log4j
Date Tue, 05 Aug 2008 19:58:29 GMT
Everything is fine with two different layouts.

Thank you very much !
Christian.

Ceki Gulcu wrote:
>
> 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.
>
>


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


Mime
View raw message