Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-2635

Wrong java.version check in ThreadNameCachingStrategy

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.13.0
    • Component/s: None
    • Labels:
      None

      Description

      I see this in ThreadNameCachingStrategy.java:

      final String defaultStrategy = System.getProperty("java.version").compareTo("1.8.0_102") < 0
              ? "CACHED" // LOG4J2-2052 JDK 8u102 removed the String allocation in Thread.getName()
              : "UNCACHED";

      This doesn't look right because java.version of, say, "1.8.0_77" compares greater than "1.8.0_102" lexicographically.  This is why I have failed tests when trying to build log4j-core.

      Similar check is also present in AsyncLoggerThreadNameStrategyTest.java.

      This was initially added in https://issues.apache.org/jira/browse/LOG4J2-2052

      [posted this on dev mailing list first, but got no response, so creating issue here]

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                fgunbin Filipp Gunbin
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: