Author: psmith
Date: Fri Dec 2 16:41:09 2005
New Revision: 351860
URL: http://svn.apache.org/viewcvs?rev=351860&view=rev
Log:
Bug 37756 A thread-safety issue with the layout being used.
Rather than add a sync block to the layout class itself, I have
placed a sync block here instead, which I believe is more appropriate.
Thanks to Eric H. for notifying us of the problem.
Modified:
logging/chainsaw/trunk/src/java/org/apache/log4j/chainsaw/layout/EventDetailLayout.java
Modified:
logging/chainsaw/trunk/src/java/org/apache/log4j/chainsaw/layout/EventDetailLayout.java
URL:
http://svn.apache.org/viewcvs/logging/chainsaw/trunk/src/java/org/apache/log4j/chainsaw/layout/EventDetailLayout.java?rev=351860&r1=351859&r2=351860&view=diff
==============================================================================
---
logging/chainsaw/trunk/src/java/org/apache/log4j/chainsaw/layout/EventDetailLayout.java
(original)
+++
logging/chainsaw/trunk/src/java/org/apache/log4j/chainsaw/layout/EventDetailLayout.java
Fri Dec 2 16:41:09 2005
@@ -270,6 +270,15 @@
*/
public void format(Writer output, LoggingEvent event)
throws IOException {
- patternLayout.format(output, copyForHTML(event));
+ LoggingEvent newEvent = copyForHTML(event);
+ /**
+ * Layouts are not thread-safe, but are normally
+ * protected by the fact that their Appender is thread-safe.
+ *
+ * But here in Chainsaw there is no such guarantees.
+ */
+ synchronized(patternLayout) {
+ patternLayout.format(output,newEvent);
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]