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

java.locale.providers set to HOST causes Log4j2 to crash in Java 9

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 2.9.0, 2.9.1
    • 2.13.0
    • None
    • Windows 10, Java 9

    Description

      When using the JUL log manager, setting the java.locale.providers property to "HOST" causes log4j2 to crash when you next log something.

      import java.util.logging.Level;
      import java.util.logging.Logger;
      
      public class LocalePropertyTest {
      
          /**
           * @param args the command line arguments
           */
          public static void main(String[] args) {
              System.setProperty("java.locale.providers", "HOST,JRE,SPI");
              System.setProperty("java.util.logging.manager", "org.apache.logging.log4j.jul.LogManager");
              Logger.getLogger(LocalePropertyTest.class.getName()).log(Level.WARNING, "this is a test");
          }
      }
      

      Used the following libraries:

      log4j-jul-2.9.1.jar
      log4j-core-2.9.1.jar
      log4j-api-2.9.1.jar

      The error is very long. Here are the first few lines:

      ERROR StatusLogger Error creating converter for d
      java.lang.reflect.InvocationTargetException
      at jdk.internal.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:564)
      at org.apache.logging.log4j.core.pattern.PatternParser.createConverter(PatternParser.java:582)
      at org.apache.logging.log4j.core.pattern.PatternParser.finalizeConverter(PatternParser.java:638)
      at org.apache.logging.log4j.core.pattern.PatternParser.parse(PatternParser.java:414)
      at org.apache.logging.log4j.core.pattern.PatternParser.parse(PatternParser.java:177)
      at org.apache.logging.log4j.core.layout.PatternLayout$SerializerBuilder.build(PatternLayout.java:376)

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            DeanWookey Dean Wookey
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment