logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: svn commit: r1231361 - in /logging/log4j/trunk/src: changes/changes.xml main/java/org/apache/log4j/MDC.java
Date Sat, 14 Jan 2012 22:31:18 GMT
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
> <ralph.goers@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 <grobmeier@gmail.com> wrote:
>> 
>>> On Sat, Jan 14, 2012 at 9:04 PM, Ralph Goers <ralph.goers@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


Mime
View raw message