You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Ralph Goers <ra...@dslextreme.com> on 2012/01/14 21:04:36 UTC

Re: svn commit: r1231361 - in /logging/log4j/trunk/src: changes/changes.xml main/java/org/apache/log4j/MDC.java

Two things:
1. This fix needs to be reverted or modified as it requires Java 5.
2. The reply-to on mails generated from subversion is dev@logging.apache.org which doesn't exist. Anyone know how to fix this?

Ralph


On Jan 13, 2012, at 2:39 PM, grobmeier@apache.org wrote:

> Author: grobmeier
> Date: Fri Jan 13 22:39:19 2012
> New Revision: 1231361
> 
> URL: http://svn.apache.org/viewvc?rev=1231361&view=rev
> Log:
> 50486 applied patch for memory leak thanks to Yingchun Chen and chahuistle
> 
> Modified:
>    logging/log4j/trunk/src/changes/changes.xml
>    logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java
> 
> Modified: logging/log4j/trunk/src/changes/changes.xml
> URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/changes/changes.xml?rev=1231361&r1=1231360&r2=1231361&view=diff
> ==============================================================================
> --- logging/log4j/trunk/src/changes/changes.xml (original)
> +++ logging/log4j/trunk/src/changes/changes.xml Fri Jan 13 22:39:19 2012
> @@ -22,6 +22,7 @@
>   <body>
>     <release version="1.2.17" date="2010-06-99" description="Maintenance release">
>        <action issue="49470">log4j 1.2.17 release preparation</action>
> +       <action issue="50486" action="fix">Memoryleak - org.apache.log4j.helpers.ThreadLocalMap</action>
>        <action issue="43282" action="fix">Eliminate duplicates in OSGi Import-Package directive.</action>
>        <action issue="48588" action="fix">DOMConfigurator does not close input stream when configured based on URL.</action>
>        <action issue="49078" action="fix">javadoc.jar was missing NOTICE and LICENSE and contained .svn entries.</action>
> 
> Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java
> URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java?rev=1231361&r1=1231360&r2=1231361&view=diff
> ==============================================================================
> --- logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java (original)
> +++ logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java Fri Jan 13 22:39:19 2012
> @@ -180,7 +180,8 @@ public class MDC {
>       Hashtable ht = (Hashtable) ((ThreadLocalMap)tlm).get();
>       if(ht != null) {
>         ht.clear();
> -      } 
> +      }
> +      ((ThreadLocalMap)tlm).remove();
>     }
>   }
> 
> 
> 


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


Re: svn commit: r1231361 - in /logging/log4j/trunk/src: changes/changes.xml main/java/org/apache/log4j/MDC.java

Posted by Christian Grobmeier <gr...@gmail.com>.
On Sat, Jan 14, 2012 at 11:31 PM, Ralph Goers
<ra...@dslextreme.com> wrote:
> I really don't think it is worth upgrading Log4j 1.x. I'm sure it is used in a lot of places because it supports old JDKs where SLF4J and Logback can't be used.
>
> Log4j 2.0 has a minimum version of Java 5. It really is at the point where it should be moved out of my private branch anyway.  At this point I'm working on documentation and a large part of that is written.
>
> What you can do is have a method somewhere that returns the Java version as an int and then test for javaVersion >= 5 before doing the remove. Then you would require Java 5 to compile but not to run. To compile with a lesser version you'd have to use Method.invoke().  IIRC Curt did something similar to that in ExtendedThrowableRenderer to take advantage of being able to get access to StackTraceElements instead of parsing the stack trace.

Thats a good idea! I will try to find out about the javaVersion and
fix the fix. Then only 1.3/4 users have the leak - they probably are
used to it.

Cheers
Christian

>
> Ralph
>
> On Jan 14, 2012, at 1:49 PM, Christian Grobmeier wrote:
>
>> Hm, I now see what you mean.
>>
>> http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/helpers/ThreadLocalMap.html
>> shows the remove method is available and inherited from ThreadLocal.
>> Clicking on it leads to the correct javadocs of 1.3, but the remove()
>> method isn't there.
>>
>> http://docs.oracle.com/javase/6/docs/api/java/lang/ThreadLocal.html#remove()
>> shows the remove method has been added in 1.5.
>>
>> Clearly the log4j apidocs should not show the remove() method.
>>
>> Crap... any ideas if we can workaround it?
>> If not, can we move on to java 1.5? I mean 1.3.... wow my grandma has
>> worked with 1.3.
>>
>> Yes I know there might be some poor guy in some corner at the world
>> working with 1.3 or 1.4, but a memory leak is really a nasty thing and
>> hey, even 1.5 is pretty old
>>
>> Cheers
>> Christian
>>
>>
>> On Sat, Jan 14, 2012 at 10:38 PM, Ralph Goers
>> <ra...@dslextreme.com> wrote:
>>> I'll look again when I get home, but when I looked this morning I thought ThreadLocalMap extended InheritablThreadLocal
>>>
>>> Sent from my iPhone
>>>
>>> On Jan 14, 2012, at 12:14 PM, Christian Grobmeier <gr...@gmail.com> wrote:
>>>
>>>> On Sat, Jan 14, 2012 at 9:04 PM, Ralph Goers <ra...@dslextreme.com> wrote:
>>>>> Two things:
>>>>> 1. This fix needs to be reverted or modified as it requires Java 5.
>>>>
>>>> Can you explain why?  ((ThreadLocalMap)tlm).remove(); - ThreadLocalMap
>>>> is a class from log4j:
>>>> http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/helpers/ThreadLocalMap.html
>>>> To my understanding it is still no problem?
>>>>
>>>> I think you mixed it up with ThreadLocal, which got a remove method in J5
>>>>
>>>>> 2. The reply-to on mails generated from subversion is dev@logging.apache.org which doesn't exist. Anyone know how to fix this?
>>>>
>>>> Guess we need to ask infra to modify that. But didn't we discuss this already?
>>>> Here is no matching list mentioned: http://logging.apache.org/mail-lists.html
>>>>
>>>> Cheers
>>>> Christian
>>>>
>>>>
>>>>>
>>>>> Ralph
>>>>>
>>>>>
>>>>> On Jan 13, 2012, at 2:39 PM, grobmeier@apache.org wrote:
>>>>>
>>>>>> Author: grobmeier
>>>>>> Date: Fri Jan 13 22:39:19 2012
>>>>>> New Revision: 1231361
>>>>>>
>>>>>> URL: http://svn.apache.org/viewvc?rev=1231361&view=rev
>>>>>> Log:
>>>>>> 50486 applied patch for memory leak thanks to Yingchun Chen and chahuistle
>>>>>>
>>>>>> Modified:
>>>>>>    logging/log4j/trunk/src/changes/changes.xml
>>>>>>    logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java
>>>>>>
>>>>>> Modified: logging/log4j/trunk/src/changes/changes.xml
>>>>>> URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/changes/changes.xml?rev=1231361&r1=1231360&r2=1231361&view=diff
>>>>>> ==============================================================================
>>>>>> --- logging/log4j/trunk/src/changes/changes.xml (original)
>>>>>> +++ logging/log4j/trunk/src/changes/changes.xml Fri Jan 13 22:39:19 2012
>>>>>> @@ -22,6 +22,7 @@
>>>>>>   <body>
>>>>>>     <release version="1.2.17" date="2010-06-99" description="Maintenance release">
>>>>>>        <action issue="49470">log4j 1.2.17 release preparation</action>
>>>>>> +       <action issue="50486" action="fix">Memoryleak - org.apache.log4j.helpers.ThreadLocalMap</action>
>>>>>>        <action issue="43282" action="fix">Eliminate duplicates in OSGi Import-Package directive.</action>
>>>>>>        <action issue="48588" action="fix">DOMConfigurator does not close input stream when configured based on URL.</action>
>>>>>>        <action issue="49078" action="fix">javadoc.jar was missing NOTICE and LICENSE and contained .svn entries.</action>
>>>>>>
>>>>>> Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java
>>>>>> URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java?rev=1231361&r1=1231360&r2=1231361&view=diff
>>>>>> ==============================================================================
>>>>>> --- logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java (original)
>>>>>> +++ logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java Fri Jan 13 22:39:19 2012
>>>>>> @@ -180,7 +180,8 @@ public class MDC {
>>>>>>       Hashtable ht = (Hashtable) ((ThreadLocalMap)tlm).get();
>>>>>>       if(ht != null) {
>>>>>>         ht.clear();
>>>>>> -      }
>>>>>> +      }
>>>>>> +      ((ThreadLocalMap)tlm).remove();
>>>>>>     }
>>>>>>   }
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> http://www.grobmeier.de
>>>> https://www.timeandbill.de
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>
>>
>>
>>
>> --
>> http://www.grobmeier.de
>> https://www.timeandbill.de
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>



-- 
http://www.grobmeier.de
https://www.timeandbill.de

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


Re: svn commit: r1231361 - in /logging/log4j/trunk/src: changes/changes.xml main/java/org/apache/log4j/MDC.java

Posted by Christian Grobmeier <gr...@gmail.com>.
Ralph (and others),

On Sat, Jan 14, 2012 at 11:31 PM, Ralph Goers
<ra...@dslextreme.com> wrote:
> I really don't think it is worth upgrading Log4j 1.x. I'm sure it is used in a lot of places because it supports old JDKs where SLF4J and Logback can't be used.
>
> Log4j 2.0 has a minimum version of Java 5. It really is at the point where it should be moved out of my private branch anyway.  At this point I'm working on documentation and a large part of that is written.
>
> What you can do is have a method somewhere that returns the Java version as an int and then test for javaVersion >= 5 before doing the remove. Then you would require Java 5 to compile but not to run. To compile with a lesser version you'd have to use Method.invoke().  IIRC Curt did something similar to that in ExtendedThrowableRenderer to take advantage of being able to get access to StackTraceElements instead of parsing the stack trace.


My feeling says this problem should have occured when running tests or
compiling on my environment. I now wrote a fix which seems to work,
but would love if you could have look on it before I commit. Basically
I do the same as Curt did, with reflection.

Cheers


Index: src/main/java/org/apache/log4j/MDC.java
===================================================================
--- src/main/java/org/apache/log4j/MDC.java	(revision 1231361)
+++ src/main/java/org/apache/log4j/MDC.java	(working copy)
@@ -17,6 +17,8 @@

 package org.apache.log4j;

+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 import java.util.Hashtable;
 import org.apache.log4j.helpers.Loader;
 import org.apache.log4j.helpers.ThreadLocalMap;
@@ -49,13 +51,21 @@
   boolean java1;

   Object tlm;
-
+
+  Method removeMethod;
+
   private
   MDC() {
     java1 = Loader.isJava1();
     if(!java1) {
       tlm = new ThreadLocalMap();
     }
+
+    try {
+      removeMethod = ThreadLocal.class.getMethod("remove", null);
+    } catch (NoSuchMethodException e) {
+      // don't do anything - java prior 1.5
+    }
   }

   /**
@@ -181,7 +191,16 @@
       if(ht != null) {
         ht.clear();
       }
-      ((ThreadLocalMap)tlm).remove();
+      if(removeMethod != null) {
+          // java 1.3/1.4 does not have remove - will suffer from a memory leak
+          try {
+            removeMethod.invoke(tlm, null);
+          } catch (IllegalAccessException e) {
+            // should not happen
+          } catch (InvocationTargetException e) {
+            // should not happen
+          }
+      }
     }
   }

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


Re: svn commit: r1231361 - in /logging/log4j/trunk/src: changes/changes.xml main/java/org/apache/log4j/MDC.java

Posted by Ralph Goers <ra...@dslextreme.com>.
I really don't think it is worth upgrading Log4j 1.x. I'm sure it is used in a lot of places because it supports old JDKs where SLF4J and Logback can't be used. 

Log4j 2.0 has a minimum version of Java 5. It really is at the point where it should be moved out of my private branch anyway.  At this point I'm working on documentation and a large part of that is written.

What you can do is have a method somewhere that returns the Java version as an int and then test for javaVersion >= 5 before doing the remove. Then you would require Java 5 to compile but not to run. To compile with a lesser version you'd have to use Method.invoke().  IIRC Curt did something similar to that in ExtendedThrowableRenderer to take advantage of being able to get access to StackTraceElements instead of parsing the stack trace.

Ralph

On Jan 14, 2012, at 1:49 PM, Christian Grobmeier wrote:

> Hm, I now see what you mean.
> 
> http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/helpers/ThreadLocalMap.html
> shows the remove method is available and inherited from ThreadLocal.
> Clicking on it leads to the correct javadocs of 1.3, but the remove()
> method isn't there.
> 
> http://docs.oracle.com/javase/6/docs/api/java/lang/ThreadLocal.html#remove()
> shows the remove method has been added in 1.5.
> 
> Clearly the log4j apidocs should not show the remove() method.
> 
> Crap... any ideas if we can workaround it?
> If not, can we move on to java 1.5? I mean 1.3.... wow my grandma has
> worked with 1.3.
> 
> Yes I know there might be some poor guy in some corner at the world
> working with 1.3 or 1.4, but a memory leak is really a nasty thing and
> hey, even 1.5 is pretty old
> 
> Cheers
> Christian
> 
> 
> On Sat, Jan 14, 2012 at 10:38 PM, Ralph Goers
> <ra...@dslextreme.com> wrote:
>> I'll look again when I get home, but when I looked this morning I thought ThreadLocalMap extended InheritablThreadLocal
>> 
>> Sent from my iPhone
>> 
>> On Jan 14, 2012, at 12:14 PM, Christian Grobmeier <gr...@gmail.com> wrote:
>> 
>>> On Sat, Jan 14, 2012 at 9:04 PM, Ralph Goers <ra...@dslextreme.com> wrote:
>>>> Two things:
>>>> 1. This fix needs to be reverted or modified as it requires Java 5.
>>> 
>>> Can you explain why?  ((ThreadLocalMap)tlm).remove(); - ThreadLocalMap
>>> is a class from log4j:
>>> http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/helpers/ThreadLocalMap.html
>>> To my understanding it is still no problem?
>>> 
>>> I think you mixed it up with ThreadLocal, which got a remove method in J5
>>> 
>>>> 2. The reply-to on mails generated from subversion is dev@logging.apache.org which doesn't exist. Anyone know how to fix this?
>>> 
>>> Guess we need to ask infra to modify that. But didn't we discuss this already?
>>> Here is no matching list mentioned: http://logging.apache.org/mail-lists.html
>>> 
>>> Cheers
>>> Christian
>>> 
>>> 
>>>> 
>>>> Ralph
>>>> 
>>>> 
>>>> On Jan 13, 2012, at 2:39 PM, grobmeier@apache.org wrote:
>>>> 
>>>>> Author: grobmeier
>>>>> Date: Fri Jan 13 22:39:19 2012
>>>>> New Revision: 1231361
>>>>> 
>>>>> URL: http://svn.apache.org/viewvc?rev=1231361&view=rev
>>>>> Log:
>>>>> 50486 applied patch for memory leak thanks to Yingchun Chen and chahuistle
>>>>> 
>>>>> Modified:
>>>>>    logging/log4j/trunk/src/changes/changes.xml
>>>>>    logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java
>>>>> 
>>>>> Modified: logging/log4j/trunk/src/changes/changes.xml
>>>>> URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/changes/changes.xml?rev=1231361&r1=1231360&r2=1231361&view=diff
>>>>> ==============================================================================
>>>>> --- logging/log4j/trunk/src/changes/changes.xml (original)
>>>>> +++ logging/log4j/trunk/src/changes/changes.xml Fri Jan 13 22:39:19 2012
>>>>> @@ -22,6 +22,7 @@
>>>>>   <body>
>>>>>     <release version="1.2.17" date="2010-06-99" description="Maintenance release">
>>>>>        <action issue="49470">log4j 1.2.17 release preparation</action>
>>>>> +       <action issue="50486" action="fix">Memoryleak - org.apache.log4j.helpers.ThreadLocalMap</action>
>>>>>        <action issue="43282" action="fix">Eliminate duplicates in OSGi Import-Package directive.</action>
>>>>>        <action issue="48588" action="fix">DOMConfigurator does not close input stream when configured based on URL.</action>
>>>>>        <action issue="49078" action="fix">javadoc.jar was missing NOTICE and LICENSE and contained .svn entries.</action>
>>>>> 
>>>>> Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java
>>>>> URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java?rev=1231361&r1=1231360&r2=1231361&view=diff
>>>>> ==============================================================================
>>>>> --- logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java (original)
>>>>> +++ logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java Fri Jan 13 22:39:19 2012
>>>>> @@ -180,7 +180,8 @@ public class MDC {
>>>>>       Hashtable ht = (Hashtable) ((ThreadLocalMap)tlm).get();
>>>>>       if(ht != null) {
>>>>>         ht.clear();
>>>>> -      }
>>>>> +      }
>>>>> +      ((ThreadLocalMap)tlm).remove();
>>>>>     }
>>>>>   }
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> http://www.grobmeier.de
>>> https://www.timeandbill.de
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>> 
> 
> 
> 
> -- 
> http://www.grobmeier.de
> https://www.timeandbill.de
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 


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


Re: svn commit: r1231361 - in /logging/log4j/trunk/src: changes/changes.xml main/java/org/apache/log4j/MDC.java

Posted by Christian Grobmeier <gr...@gmail.com>.
Hm, I now see what you mean.

http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/helpers/ThreadLocalMap.html
shows the remove method is available and inherited from ThreadLocal.
Clicking on it leads to the correct javadocs of 1.3, but the remove()
method isn't there.

http://docs.oracle.com/javase/6/docs/api/java/lang/ThreadLocal.html#remove()
shows the remove method has been added in 1.5.

Clearly the log4j apidocs should not show the remove() method.

Crap... any ideas if we can workaround it?
If not, can we move on to java 1.5? I mean 1.3.... wow my grandma has
worked with 1.3.

Yes I know there might be some poor guy in some corner at the world
working with 1.3 or 1.4, but a memory leak is really a nasty thing and
hey, even 1.5 is pretty old

Cheers
Christian


On Sat, Jan 14, 2012 at 10:38 PM, Ralph Goers
<ra...@dslextreme.com> wrote:
> I'll look again when I get home, but when I looked this morning I thought ThreadLocalMap extended InheritablThreadLocal
>
> Sent from my iPhone
>
> On Jan 14, 2012, at 12:14 PM, Christian Grobmeier <gr...@gmail.com> wrote:
>
>> On Sat, Jan 14, 2012 at 9:04 PM, Ralph Goers <ra...@dslextreme.com> wrote:
>>> Two things:
>>> 1. This fix needs to be reverted or modified as it requires Java 5.
>>
>> Can you explain why?  ((ThreadLocalMap)tlm).remove(); - ThreadLocalMap
>> is a class from log4j:
>> http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/helpers/ThreadLocalMap.html
>> To my understanding it is still no problem?
>>
>> I think you mixed it up with ThreadLocal, which got a remove method in J5
>>
>>> 2. The reply-to on mails generated from subversion is dev@logging.apache.org which doesn't exist. Anyone know how to fix this?
>>
>> Guess we need to ask infra to modify that. But didn't we discuss this already?
>> Here is no matching list mentioned: http://logging.apache.org/mail-lists.html
>>
>> Cheers
>> Christian
>>
>>
>>>
>>> Ralph
>>>
>>>
>>> On Jan 13, 2012, at 2:39 PM, grobmeier@apache.org wrote:
>>>
>>>> Author: grobmeier
>>>> Date: Fri Jan 13 22:39:19 2012
>>>> New Revision: 1231361
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1231361&view=rev
>>>> Log:
>>>> 50486 applied patch for memory leak thanks to Yingchun Chen and chahuistle
>>>>
>>>> Modified:
>>>>    logging/log4j/trunk/src/changes/changes.xml
>>>>    logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java
>>>>
>>>> Modified: logging/log4j/trunk/src/changes/changes.xml
>>>> URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/changes/changes.xml?rev=1231361&r1=1231360&r2=1231361&view=diff
>>>> ==============================================================================
>>>> --- logging/log4j/trunk/src/changes/changes.xml (original)
>>>> +++ logging/log4j/trunk/src/changes/changes.xml Fri Jan 13 22:39:19 2012
>>>> @@ -22,6 +22,7 @@
>>>>   <body>
>>>>     <release version="1.2.17" date="2010-06-99" description="Maintenance release">
>>>>        <action issue="49470">log4j 1.2.17 release preparation</action>
>>>> +       <action issue="50486" action="fix">Memoryleak - org.apache.log4j.helpers.ThreadLocalMap</action>
>>>>        <action issue="43282" action="fix">Eliminate duplicates in OSGi Import-Package directive.</action>
>>>>        <action issue="48588" action="fix">DOMConfigurator does not close input stream when configured based on URL.</action>
>>>>        <action issue="49078" action="fix">javadoc.jar was missing NOTICE and LICENSE and contained .svn entries.</action>
>>>>
>>>> Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java
>>>> URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java?rev=1231361&r1=1231360&r2=1231361&view=diff
>>>> ==============================================================================
>>>> --- logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java (original)
>>>> +++ logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java Fri Jan 13 22:39:19 2012
>>>> @@ -180,7 +180,8 @@ public class MDC {
>>>>       Hashtable ht = (Hashtable) ((ThreadLocalMap)tlm).get();
>>>>       if(ht != null) {
>>>>         ht.clear();
>>>> -      }
>>>> +      }
>>>> +      ((ThreadLocalMap)tlm).remove();
>>>>     }
>>>>   }
>>>>
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>
>>
>>
>>
>> --
>> http://www.grobmeier.de
>> https://www.timeandbill.de
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>



-- 
http://www.grobmeier.de
https://www.timeandbill.de

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


Re: svn commit: r1231361 - in /logging/log4j/trunk/src: changes/changes.xml main/java/org/apache/log4j/MDC.java

Posted by Ralph Goers <ra...@dslextreme.com>.
I'll look again when I get home, but when I looked this morning I thought ThreadLocalMap extended InheritablThreadLocal

Sent from my iPhone

On Jan 14, 2012, at 12:14 PM, Christian Grobmeier <gr...@gmail.com> wrote:

> On Sat, Jan 14, 2012 at 9:04 PM, Ralph Goers <ra...@dslextreme.com> wrote:
>> Two things:
>> 1. This fix needs to be reverted or modified as it requires Java 5.
> 
> Can you explain why?  ((ThreadLocalMap)tlm).remove(); - ThreadLocalMap
> is a class from log4j:
> http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/helpers/ThreadLocalMap.html
> To my understanding it is still no problem?
> 
> I think you mixed it up with ThreadLocal, which got a remove method in J5
> 
>> 2. The reply-to on mails generated from subversion is dev@logging.apache.org which doesn't exist. Anyone know how to fix this?
> 
> Guess we need to ask infra to modify that. But didn't we discuss this already?
> Here is no matching list mentioned: http://logging.apache.org/mail-lists.html
> 
> Cheers
> Christian
> 
> 
>> 
>> Ralph
>> 
>> 
>> On Jan 13, 2012, at 2:39 PM, grobmeier@apache.org wrote:
>> 
>>> Author: grobmeier
>>> Date: Fri Jan 13 22:39:19 2012
>>> New Revision: 1231361
>>> 
>>> URL: http://svn.apache.org/viewvc?rev=1231361&view=rev
>>> Log:
>>> 50486 applied patch for memory leak thanks to Yingchun Chen and chahuistle
>>> 
>>> Modified:
>>>    logging/log4j/trunk/src/changes/changes.xml
>>>    logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java
>>> 
>>> Modified: logging/log4j/trunk/src/changes/changes.xml
>>> URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/changes/changes.xml?rev=1231361&r1=1231360&r2=1231361&view=diff
>>> ==============================================================================
>>> --- logging/log4j/trunk/src/changes/changes.xml (original)
>>> +++ logging/log4j/trunk/src/changes/changes.xml Fri Jan 13 22:39:19 2012
>>> @@ -22,6 +22,7 @@
>>>   <body>
>>>     <release version="1.2.17" date="2010-06-99" description="Maintenance release">
>>>        <action issue="49470">log4j 1.2.17 release preparation</action>
>>> +       <action issue="50486" action="fix">Memoryleak - org.apache.log4j.helpers.ThreadLocalMap</action>
>>>        <action issue="43282" action="fix">Eliminate duplicates in OSGi Import-Package directive.</action>
>>>        <action issue="48588" action="fix">DOMConfigurator does not close input stream when configured based on URL.</action>
>>>        <action issue="49078" action="fix">javadoc.jar was missing NOTICE and LICENSE and contained .svn entries.</action>
>>> 
>>> Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java
>>> URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java?rev=1231361&r1=1231360&r2=1231361&view=diff
>>> ==============================================================================
>>> --- logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java (original)
>>> +++ logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java Fri Jan 13 22:39:19 2012
>>> @@ -180,7 +180,8 @@ public class MDC {
>>>       Hashtable ht = (Hashtable) ((ThreadLocalMap)tlm).get();
>>>       if(ht != null) {
>>>         ht.clear();
>>> -      }
>>> +      }
>>> +      ((ThreadLocalMap)tlm).remove();
>>>     }
>>>   }
>>> 
>>> 
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>> 
> 
> 
> 
> -- 
> http://www.grobmeier.de
> https://www.timeandbill.de
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 

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


Re: svn commit: r1231361 - in /logging/log4j/trunk/src: changes/changes.xml main/java/org/apache/log4j/MDC.java

Posted by Ralph Goers <ra...@dslextreme.com>.
The remove method of ThreadLocal was added in Java 5

Sent from my iPhone

On Jan 14, 2012, at 12:14 PM, Christian Grobmeier <gr...@gmail.com> wrote:

> On Sat, Jan 14, 2012 at 9:04 PM, Ralph Goers <ra...@dslextreme.com> wrote:
>> Two things:
>> 1. This fix needs to be reverted or modified as it requires Java 5.
> 
> Can you explain why?  ((ThreadLocalMap)tlm).remove(); - ThreadLocalMap
> is a class from log4j:
> http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/helpers/ThreadLocalMap.html
> To my understanding it is still no problem?
> 
> I think you mixed it up with ThreadLocal, which got a remove method in J5
> 
>> 2. The reply-to on mails generated from subversion is dev@logging.apache.org which doesn't exist. Anyone know how to fix this?
> 
> Guess we need to ask infra to modify that. But didn't we discuss this already?
> Here is no matching list mentioned: http://logging.apache.org/mail-lists.html
> 
> Cheers
> Christian
> 
> 
>> 
>> Ralph
>> 
>> 
>> On Jan 13, 2012, at 2:39 PM, grobmeier@apache.org wrote:
>> 
>>> Author: grobmeier
>>> Date: Fri Jan 13 22:39:19 2012
>>> New Revision: 1231361
>>> 
>>> URL: http://svn.apache.org/viewvc?rev=1231361&view=rev
>>> Log:
>>> 50486 applied patch for memory leak thanks to Yingchun Chen and chahuistle
>>> 
>>> Modified:
>>>    logging/log4j/trunk/src/changes/changes.xml
>>>    logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java
>>> 
>>> Modified: logging/log4j/trunk/src/changes/changes.xml
>>> URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/changes/changes.xml?rev=1231361&r1=1231360&r2=1231361&view=diff
>>> ==============================================================================
>>> --- logging/log4j/trunk/src/changes/changes.xml (original)
>>> +++ logging/log4j/trunk/src/changes/changes.xml Fri Jan 13 22:39:19 2012
>>> @@ -22,6 +22,7 @@
>>>   <body>
>>>     <release version="1.2.17" date="2010-06-99" description="Maintenance release">
>>>        <action issue="49470">log4j 1.2.17 release preparation</action>
>>> +       <action issue="50486" action="fix">Memoryleak - org.apache.log4j.helpers.ThreadLocalMap</action>
>>>        <action issue="43282" action="fix">Eliminate duplicates in OSGi Import-Package directive.</action>
>>>        <action issue="48588" action="fix">DOMConfigurator does not close input stream when configured based on URL.</action>
>>>        <action issue="49078" action="fix">javadoc.jar was missing NOTICE and LICENSE and contained .svn entries.</action>
>>> 
>>> Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java
>>> URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java?rev=1231361&r1=1231360&r2=1231361&view=diff
>>> ==============================================================================
>>> --- logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java (original)
>>> +++ logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java Fri Jan 13 22:39:19 2012
>>> @@ -180,7 +180,8 @@ public class MDC {
>>>       Hashtable ht = (Hashtable) ((ThreadLocalMap)tlm).get();
>>>       if(ht != null) {
>>>         ht.clear();
>>> -      }
>>> +      }
>>> +      ((ThreadLocalMap)tlm).remove();
>>>     }
>>>   }
>>> 
>>> 
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>> 
> 
> 
> 
> -- 
> http://www.grobmeier.de
> https://www.timeandbill.de
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 

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


Re: svn commit: r1231361 - in /logging/log4j/trunk/src: changes/changes.xml main/java/org/apache/log4j/MDC.java

Posted by Christian Grobmeier <gr...@gmail.com>.
On Sat, Jan 14, 2012 at 9:04 PM, Ralph Goers <ra...@dslextreme.com> wrote:
> Two things:
> 1. This fix needs to be reverted or modified as it requires Java 5.

Can you explain why?  ((ThreadLocalMap)tlm).remove(); - ThreadLocalMap
is a class from log4j:
http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/helpers/ThreadLocalMap.html
To my understanding it is still no problem?

I think you mixed it up with ThreadLocal, which got a remove method in J5

> 2. The reply-to on mails generated from subversion is dev@logging.apache.org which doesn't exist. Anyone know how to fix this?

Guess we need to ask infra to modify that. But didn't we discuss this already?
Here is no matching list mentioned: http://logging.apache.org/mail-lists.html

Cheers
Christian


>
> Ralph
>
>
> On Jan 13, 2012, at 2:39 PM, grobmeier@apache.org wrote:
>
>> Author: grobmeier
>> Date: Fri Jan 13 22:39:19 2012
>> New Revision: 1231361
>>
>> URL: http://svn.apache.org/viewvc?rev=1231361&view=rev
>> Log:
>> 50486 applied patch for memory leak thanks to Yingchun Chen and chahuistle
>>
>> Modified:
>>    logging/log4j/trunk/src/changes/changes.xml
>>    logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java
>>
>> Modified: logging/log4j/trunk/src/changes/changes.xml
>> URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/changes/changes.xml?rev=1231361&r1=1231360&r2=1231361&view=diff
>> ==============================================================================
>> --- logging/log4j/trunk/src/changes/changes.xml (original)
>> +++ logging/log4j/trunk/src/changes/changes.xml Fri Jan 13 22:39:19 2012
>> @@ -22,6 +22,7 @@
>>   <body>
>>     <release version="1.2.17" date="2010-06-99" description="Maintenance release">
>>        <action issue="49470">log4j 1.2.17 release preparation</action>
>> +       <action issue="50486" action="fix">Memoryleak - org.apache.log4j.helpers.ThreadLocalMap</action>
>>        <action issue="43282" action="fix">Eliminate duplicates in OSGi Import-Package directive.</action>
>>        <action issue="48588" action="fix">DOMConfigurator does not close input stream when configured based on URL.</action>
>>        <action issue="49078" action="fix">javadoc.jar was missing NOTICE and LICENSE and contained .svn entries.</action>
>>
>> Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java
>> URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java?rev=1231361&r1=1231360&r2=1231361&view=diff
>> ==============================================================================
>> --- logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java (original)
>> +++ logging/log4j/trunk/src/main/java/org/apache/log4j/MDC.java Fri Jan 13 22:39:19 2012
>> @@ -180,7 +180,8 @@ public class MDC {
>>       Hashtable ht = (Hashtable) ((ThreadLocalMap)tlm).get();
>>       if(ht != null) {
>>         ht.clear();
>> -      }
>> +      }
>> +      ((ThreadLocalMap)tlm).remove();
>>     }
>>   }
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>



-- 
http://www.grobmeier.de
https://www.timeandbill.de

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