[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: JDK version for log4j1.2.X Curt Arnold Wed Jun 24 19:00:28 2009

Should update the FAQ since it still mentions log4j 1.3 which has been discontinued.

The target parameter indicates the byte-code format to be generated in the compile step. It implies the minimum JRE revision below which loading is prohibited. It does not indicate the suggested, recommended or tested minimum JRE.

The current log4j 1.2.x builds generate JDK 1.1 compatible byte-code. Some features such as AsyncAppender require JDK 1.2 features, but as long as those appenders are not used, it should be theoretically possible to use log4j in a JDK 1.1 compatible environment.

There is problems some very early JRE's where they either will not load valid byte-code that was generated by later compilers and early compilers where they would not successfully compile valid source code. The minefield of problems makes it very frustrating to build or test on Sun environments earlier than JDK 1.3.

The byte-code format changed at version JDK 1.4 and Java 5. The byte- code formats for JDK 1.1-1.3 are identical except for the version declaration. Changing the byte code format from 1.1 to 1.2 or 1.3 would only stop earlier JVM's (or more likely environments that are compatible with earlier JVM's) from attempting to load log4j. All that would occur from bumping the version from 1.1 to 1.2 would be to prevent any hypothetical users on a JDK 1.1 compatible platform from using that release.

JDK 1.4 is used for release builds and testing. JDK 1.3 can build and log4j using Ant (but not Maven which requires JDK 1.4) and the release build from the Maven build works fine. I don't think I could get JDK 1.2 or 1.1 to run the tests using a bat file on Windows, but that was due to defects in the environment.

log4j 1.2.x does not intentionally use any features later than JDK 1.2 (though we might have relaxed that a few years back so maybe there is something that depends on JDK 1.3). log4j-extras can contain things that require JDK 1.4 or later features.

Hope that makes things clearer.

On Jun 24, 2009, at 2:09 PM, Gilles Scokart wrote:

Looking on the mailing list [1] and on bugzilla [2] I got the info that log4j 1.2.x target JDK 1.1. The website [3] doesn't say something different.

However, when I look in the code, I see some usage of classes that only exists in 1.2 (HashMap and ThreadLocal for instance, and there is probably others). The usage of the targeting in the compilers is just completely broken, because the compiler just produce byte code in the targeting format, but doesn't check if you are using new classes/methods. It unfortunately doesn't check the 'since' tags of the methods (the Sun compiler at least).

So, I'm afraid the target target 1.1 specified in the pom [4] should be changed (or you should find a 1.1 build environment, or at least a 1.1 test environment).

[1] http://markmail.org/message/whsluupp4nub7hb3
[2] https://issues.apache.org/bugzilla/show_bug.cgi?id=42189#c18
[3] http://logging.apache.org/log4j/1.2/faq.html#1.3
[4] http://svn.apache.org/repos/asf/logging/log4j/trunk/pom.xml

Gilles Scokart

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]