[
https://issues.apache.org/jira/browse/LOG4J2-409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13774598#comment-13774598
]
Nick Williams edited comment on LOG4J2-409 at 9/23/13 2:50 PM:
---------------------------------------------------------------
Thanks for reporting this, Frank. Looks like there are two distinct but related
problems here. First, the documentation should not show backslashes, because
those are indeed illegal in URIs. That's an easy fix. Second, the variable
substitution is resulting in an invalid URI (because of the backslashes). This
is a trickier problem, because variable substitution has no idea what the
semantics of a variable value are. It could be a file path, a person's name, a
database connection, or someone's favorite color. We're either going to have to
put some context around variable substitution so that it can intelligently
replace backslashes with forward slashes, or we're going to have to deal with
the problem further down the line before converting values to URIs. I'm going
to have to think on this one for a bit.
was (Author: beamerblvd):
Thanks for reporting this, Frank. Looks like there are two distinct but
related problems here. First, the documentation should not show backslashes,
because those are indeed illegal in URIs. That's an easy fix. Second, the
variable substitution is resulting in an invalid URI (because of the
backslashes). This is a trickier problem, because variable solution has no idea
what the semantics of a variable value are. It could be a file path, a person's
name, a database connection, or someone's favorite color. We're either going to
have to put some context around variable substitution so that it can
intelligently replace backslashes with forward slashes, or we're going to have
to deal with the problem further down the line before converting values to
URIs. I'm going to have to think on this one for a bit.
> Specifying log4jConfiguration in web.xml fails on Windows when using
> ${user.home}
> ---------------------------------------------------------------------------------
>
> Key: LOG4J2-409
> URL: https://issues.apache.org/jira/browse/LOG4J2-409
> Project: Log4j 2
> Issue Type: Bug
> Affects Versions: 2.0-beta8
> Environment: Windows 7, Apache Tomcat 7, Java 7
> Reporter: Frank Steinmann
>
> When specifying the context parameter log4jConfiguration in the web.xml of a
> web application and using $\{user.home\} as part of the path, e.g.
> {code:xml}
> <context-param>
> <param-name>log4jConfiguration</param-name>
> <param-value>file://${user.home}/someDirectory/log4j2.xml</param-value>
> </context-param>
> {code}
> the following exception is thrown on Windows systems:
> {noformat}
> java.net.URISyntaxException: Illegal character in authority at index 7:
> file://C:\Users\steinman/someDirectory/log4j2.xml
> at java.net.URI$Parser.fail(Unknown Source)
> at java.net.URI$Parser.parseAuthority(Unknown Source)
> at java.net.URI$Parser.parseHierarchical(Unknown Source)
> at java.net.URI$Parser.parse(Unknown Source)
> at java.net.URI.<init>(Unknown Source)
> at
> org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:46)
> ...
> {noformat}
> It is because of the backslashes that are not allowed in URIs.
> There is an example in the documentation using backslashes
> ([http://logging.apache.org/log4j/2.x/manual/webapp.html]) which will produce
> the same exception.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]