You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Tim Balzer (JIRA)" <ji...@apache.org> on 2019/03/05 14:48:00 UTC

[jira] [Commented] (LOG4J2-2058) java.locale.providers set to HOST causes Log4j2 to crash in Java 9

    [ https://issues.apache.org/jira/browse/LOG4J2-2058?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16784527#comment-16784527 ] 

Tim Balzer commented on LOG4J2-2058:
------------------------------------

I've just observed this stack overflow behavior when using Log4J 2.11.1 with the JUL adapter and OpenJDK 11.0.2 (inside docker), manually configuring no properties except for "java.util.logging.manager".

Forcing "java.locale.providers" to "COMPAT" or "JRE" fixes the issue (or rather works around it), but in my setup both "HOST" and "CLDR" with a higher priority than the default behavior cause this to happen.

I suspect more people will run into this with newer Java versions in the future.

> java.locale.providers set to HOST causes Log4j2 to crash in Java 9
> ------------------------------------------------------------------
>
>                 Key: LOG4J2-2058
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2058
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: JUL adapter, Pattern Converters
>    Affects Versions: 2.9.0, 2.9.1
>         Environment: Windows 10, Java 9
>            Reporter: Dean Wookey
>            Priority: Blocker
>
> When using the JUL log manager, setting the java.locale.providers property to "HOST" causes log4j2 to crash when you next log something. 
> {code:java}
> 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");
>     }
> }
> {code}
> 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)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)