Hi Elias,
I had a cursory look at the code. It looks pretty good.
Although it may be my suggestion to begin with, comparing
ConcurrentAppender ca = new ConcurrentAppender() {
protected void append(LoggingEvent event) {
try { Thread.sleep(1); } catch (InterruptedException e) {}
}
protected void internalClose() {}
};
and
AppenderSkeleton as = new AppenderSkeleton() {
protected void append(LoggingEvent event) {
try { Thread.sleep(1); } catch (InterruptedException e) {}
}
public void close() {}
};is meaningless.
Do you have numbers comparing
org.apache.log4j.WriterAppender wa = new org.apache.log4j.WriterAppender();
wa.setWriter(w);
new PerformanceTest(wa);
with
org.apache.log4j.concurrent.WriterAppender wa2 = new org.apache.log4j.concurrent.WriterAppender();
wa2.setWriter(w);
new PerformanceTest(wa2);
Since the existing Layouts recycle the string buffer, in the single threaded case, I would expect the existing code to outperform your version which creates a new CharArrayWriter with each conversion. You seem to indicate that the performances are more or less on par.
At 06:42 PM 1/22/2005, Elias Ross wrote:
Here are the files plus a patch to the pattern layout classes. (Modifying the layout classes to be thread-safe was a separate step.)
It's still a bit rough around the edges, especially the javadoc. I pretty much copied/pasted the implementations of Writer and Console appender, with a few changes here and there.
I use ThreadLocal in a few places, which is only available in JVM 1.2+
Using ThreadLocal for the guard is a bit confusing, but nifty nonetheless.
-- 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]
