You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Thomas Papke (JIRA)" <ji...@apache.org> on 2016/03/23 08:09:25 UTC

[jira] [Created] (LOG4J2-1328) JMX setting for ConfigLocationUri does not pick the right classloader for "classpath:" locations

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-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org