[
https://issues.apache.org/jira/browse/LOG4J2-2994?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17260529#comment-17260529
]
Chen Levy commented on LOG4J2-2994:
-----------------------------------
In old versions, such as 2.1, setting the configuration file without a
protocol, e.g.
{code:java}
-Dlog4j.configurationFile="%CATALINA_HOME%\conf\log4j2.xml"
{code}
Would result in:
{code:java}
ERROR StatusLogger Invalid URL
C:/Work/Servers/apache-tomcat-9.0.40/conf/log4j2.xml
java.net.MalformedURLException: unknown protocol: c
at java.base/java.net.URL.<init>(URL.java:679)
at java.base/java.net.URL.fromURI(URL.java:746)
at java.base/java.net.URI.toURL(URI.java:1139)
at
org.apache.logging.log4j.core.config.ConfigurationFactory.getInputFromUri(ConfigurationFactory.java:296)
at
org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:395)
at
org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:254)
at
org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:419)
at
org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:138)
at
org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:147)
at
org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:41)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:175)
at
org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:102)
at
org.apache.logging.log4j.jul.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:34)
at
org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:42)
at org.apache.logging.log4j.jul.LogManager.getLogger(LogManager.java:89)
at
java.logging/java.util.logging.LogManager.demandSystemLogger(LogManager.java:571)
at
java.logging/java.util.logging.LogManager$LoggingProviderAccess.demandLoggerFor(LogManager.java:2710)
at
java.logging/sun.util.logging.internal.LoggingProviderImpl.demandJULLoggerFor(LoggingProviderImpl.java:411)
at
java.logging/sun.util.logging.internal.LoggingProviderImpl.demandLoggerFor(LoggingProviderImpl.java:436)
at
java.base/jdk.internal.logger.DefaultLoggerFinder.getLogger(DefaultLoggerFinder.java:157)
at
java.base/jdk.internal.logger.LazyLoggers.getLoggerFromFinder(LazyLoggers.java:389)
at
java.base/jdk.internal.logger.LazyLoggers.getLazyLogger(LazyLoggers.java:444)
at
java.base/jdk.internal.logger.LazyLoggers.getLogger(LazyLoggers.java:414)
at java.base/java.lang.System.getLogger(System.java:1679)
at
jdk.management.agent/sun.management.jmxremote.ConnectorBootstrap.<clinit>(ConnectorBootstrap.java:890)
at
jdk.management.agent/jdk.internal.agent.Agent.startAgent(Agent.java:447)
at
jdk.management.agent/jdk.internal.agent.Agent.startAgent(Agent.java:599)
{code}
Using either file:// or file:/// corrected that.
In 2.13.2, file:// stopped working, but now you can remove the protocol
altogether, which is what I did
> Setting configuration file path no longer works with Windows OS
> ---------------------------------------------------------------
>
> Key: LOG4J2-2994
> URL: https://issues.apache.org/jira/browse/LOG4J2-2994
> Project: Log4j 2
> Issue Type: Bug
> Components: Configuration
> Affects Versions: 2.13.2, 2.14.0, 2.13.3
> Environment: Windows 10
> Tomcat 9.0.40
> AdoptOpenJDK 15.0.1
> Reporter: Chen Levy
> Priority: Major
>
> Hello Everyone
> Our project uses the following configuration when setting up Log4J2 with
> Tomcat:
> {code:java}
> -Dlog4j.configurationFile=$CATALINA_HOME/conf/log4j2.xml
> {code}
> This worked fine for many years now, but starting with version 2.13.2 we get
> the following exception on Windows machines:
> {code:java}
> ERROR StatusLogger Unable to access
> file://C/Work/Servers/apache-tomcat-9.0.40/conf/log4j2.xml
> java.net.UnknownHostException: C
> at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:567)
> at java.base/java.net.Socket.connect(Socket.java:648)
> at java.base/sun.net.ftp.impl.FtpClient.doConnect(FtpClient.java:961)
> at java.base/sun.net.ftp.impl.FtpClient.tryConnect(FtpClient.java:923)
> at java.base/sun.net.ftp.impl.FtpClient.connect(FtpClient.java:1018)
> at java.base/sun.net.ftp.impl.FtpClient.connect(FtpClient.java:1004)
> at
> java.base/sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:319)
> at
> java.base/sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:425)
> at
> org.apache.logging.log4j.core.config.ConfigurationSource.fromUri(ConfigurationSource.java:338)
> at
> org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:507)
> at
> org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:500)
> at
> org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:423)
> at
> org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:323)
> at
> org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:691)
> at
> org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:712)
> at
> org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:267)
> at
> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:155)
> at
> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
> at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
> at
> org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:138)
> at
> org.apache.logging.log4j.jul.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:34)
> at
> org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:48)
> at org.apache.logging.log4j.jul.LogManager.getLogger(LogManager.java:96)
> at
> java.logging/java.util.logging.LogManager.demandSystemLogger(LogManager.java:571)
> at
> java.logging/java.util.logging.LogManager$LoggingProviderAccess.demandLoggerFor(LogManager.java:2710)
> at
> java.logging/sun.util.logging.internal.LoggingProviderImpl.demandJULLoggerFor(LoggingProviderImpl.java:411)
> at
> java.logging/sun.util.logging.internal.LoggingProviderImpl.demandLoggerFor(LoggingProviderImpl.java:436)
> at
> java.base/jdk.internal.logger.DefaultLoggerFinder.getLogger(DefaultLoggerFinder.java:157)
> at
> java.base/jdk.internal.logger.LazyLoggers.getLoggerFromFinder(LazyLoggers.java:389)
> at
> java.base/jdk.internal.logger.LazyLoggers.getLazyLogger(LazyLoggers.java:444)
> at
> java.base/jdk.internal.logger.LazyLoggers.getLogger(LazyLoggers.java:414)
> at java.base/java.lang.System.getLogger(System.java:1679)
> at
> jdk.management.agent/sun.management.jmxremote.ConnectorBootstrap.<clinit>(ConnectorBootstrap.java:890)
> at
> jdk.management.agent/jdk.internal.agent.Agent.startAgent(Agent.java:447)
> at
> jdk.management.agent/jdk.internal.agent.Agent.startAgent(Agent.java:599)
> {code}
> This prevents us from upgrading pass 2.13.1
> Thanks
--
This message was sent by Atlassian Jira
(v8.3.4#803005)