This repository was archived by the owner on Sep 13, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +15
-15
lines changed
main/java/org/apache/log4j
tests/src/java/org/apache/log4j/helpers Expand file tree Collapse file tree 4 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -72,9 +72,7 @@ public class MDC {
7272
7373 private MDC () {
7474 java1 = Loader .isJava1 ();
75- if (!java1 ) {
76- tlm = new ThreadLocalMap ();
77- }
75+ tlm = new ThreadLocalMap ();
7876
7977 try {
8078 removeMethod = ThreadLocal .class .getMethod ("remove" , null );
Original file line number Diff line number Diff line change @@ -33,22 +33,12 @@ public class Loader {
3333
3434 static final String TSTR = "Caught Exception while in Loader.getResource. This may be innocuous." ;
3535
36- // We conservatively assume that we are running under Java 1.x
37- static private boolean java1 = true ;
36+ // We are on java 1.2+ since we compile with source/target >1.4
37+ static private final boolean java1 = false ;
3838
3939 static private boolean ignoreTCL = false ;
4040
4141 static {
42- String prop = OptionConverter .getSystemProperty ("java.version" , null );
43-
44- if (prop != null ) {
45- int i = prop .indexOf ('.' );
46- if (i != -1 ) {
47- if (prop .charAt (i +1 ) != '1' ) {
48- java1 = false ;
49- }
50- }
51- }
5242 String ignoreTCLProp = OptionConverter .getSystemProperty ("log4j.ignoreTCL" , null );
5343 if (ignoreTCLProp != null ) {
5444 ignoreTCL = OptionConverter .toBoolean (ignoreTCLProp , true );
Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ Java Version Incompatibilities
3232 {{{https://blogs.apache.org/logging/entry/moving_on_to_log4j_2}Log4j 1.2 is broken on Java 9}}
3333 for details.
3434
35+ Switch to Log4J >=1.2.18 to get MDC to work.
36+
3537Apache log4j\u2122 1.2
3638
3739 Welcome to Apache log4j, a logging library for Java. Apache log4j
Original file line number Diff line number Diff line change 1+ package org .apache .log4j .helpers ;
2+
3+ import junit .framework .TestCase ;
4+
5+ public class LoaderTest extends TestCase {
6+
7+ public void testIsJava1IsAlwaysFalse () {
8+ assertFalse (Loader .isJava1 ());
9+ }
10+ }
You can’t perform that action at this time.
0 commit comments