Thomas Papke created LOG4J2-1328:
------------------------------------

             Summary: JMX setting for ConfigLocationUri does not pick the right 
classloader for "classpath:" locations
                 Key: LOG4J2-1328
                 URL: https://issues.apache.org/jira/browse/LOG4J2-1328
             Project: Log4j 2
          Issue Type: Bug
          Components: JMX
    Affects Versions: 2.5
            Reporter: Thomas Papke


The JMX ConfigLocationUri seems to partially struggle with “classpath:” Uris 
that point to the classpath of one of the webapps (I use log4j-web.jar in the 
webapp). I saw that the LoggerContextAdmin internally use “new 
URL(configLocation);” to load the file. So pressing "Enter" in JMX for 
releading the classpath log4j configuration, fails for some webapps because the 
configuration file will not be found.

Here some output from the Jconsole Mbean:
- Loading the Configlocation for the first webapp work, doing the same for the 
second one fail (but the file is present in the second webapp WEB-INF/classes 
folder)
{code}
sorting table against column=0 ascending=true
edit: ConfigLocationUri=classpath:/log4j2-webapp1.xml
validating [row=2, column=1]: ConfigLocationUri=classpath:/log4j2-webapp1.xml
setAttribute(ConfigLocationUri=classpath:/log4j2-webapp1.xml)
sorting table against column=0 ascending=true
edit: ConfigLocationUri=classpath:/log4j2-webapp2.xml
validating [row=2, column=1]: ConfigLocationUri=classpath:/log4j2-webapp2.xml
setAttribute(ConfigLocationUri=classpath:/log4j2-webapp2.xml)
java.io.FileNotFoundException: Unable to load the resource 
[classpath:/log4j2-webapp2.xml] using the thread context class loader or the 
current classs class loader
        at 
org.apache.naming.resources.ClasspathURLStreamHandler.openConnection(ClasspathURLStreamHandler.java:45)
        at java.net.URL.openConnection(URL.java:972)
        at java.net.URL.openStream(URL.java:1038)
        at 
org.apache.logging.log4j.core.jmx.LoggerContextAdmin.setConfigLocationUri(LoggerContextAdmin.java:133)
...
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to