What do you get if you change the -D to 
log4j.configurationFile=“file://%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j2.xml”?
  A normal file protocol on Windows shouldl end up looking like 
file:///C:/path/to/file/file.txt.

See https://blogs.msdn.microsoft.com/ie/2006/12/06/file-uris-in-windows/ (just 
one of several links I found) to illustrate this.

Ralph

> On Jul 3, 2018, at 8:10 AM, Shawn Heisey <apa...@elyograg.org> wrote:
> 
> I'm investigating a problem a user is having with starting the latest
> release of Solr on Windows.  This release is the first one we've made
> after upgrading log4j from 1.2.x to 2.11.0.
> 
> I have double-checked that the script starts the program with this
> commandline option:
> 
> -Dlog4j.configurationFile="file:C:\Users\sheisey\Downloads\solr-7.4.0\server\scripts\cloud-scripts\log4j2.xml"
> 
> This is what's actually in the .cmd file ... I used the 'echo' command
> to verify what the full commandline expands to:
> 
> -Dlog4j.configurationFile="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j2.xml"
> 
> An exception is sent to stdout, which I will provide at the end of this
> message.
> 
> In the exception, you may notice that the path it says it can't find has
> TWO "file:" elements in it, and two paths complete with "C:\" in them. 
> The value of DEFAULT_SERVER_DIR is
> C:\Users\sheisey\Downloads\solr-7.4.0\server ... which is what's before
> the second "file:" in the exception, with the backslashes converted to
> forward slashes.  Unless something is going very wrong with the windows
> command script language so that the commandline isn't actually what I've
> double-checked it to be, it looks like a problem in log4j ... one that
> might only exist on Windows.
> 
> I'm running this on Windows 7 enterprise edition, the user on the Solr
> mailing list is running it on Windows 10 enterprise edition and running
> into the same problem.
> 
> If I remove the "file:" prefix from the value assigned to the system
> property, so that it is a bare Windows path, everything works properly. 
> This workaround was mentioned by the user on the Solr mailing list.
> 
> The same thing on Linux appears to work correctly.  This is the
> commandline option that ends up being used there:
> 
> -Dlog4j.configurationFile=file:/index/src/solr-7.4.0/server/scripts/cloud-scripts/log4j2.xml
> 
> Here's the exception that I get on Windows:
> 
> ERROR StatusLogger Unable to access
> file:/C:/Users/sheisey/Downloads/solr-7.4.0/server/file:C:/Users/sheisey/Downloads/solr-7.4.0/server/scripts/cloud-scripts/log4j2.xml
> java.io.FileNotFoundException:
> C:\Users\sheisey\Downloads\solr-7.4.0\server\file:C:\Users\sheisey\Downloads\solr-7.4.0\server\scripts\cloud-scripts\log4j2.xml
> (The filename, directory name, or volume label syntax is incorrect)
>         at java.io.FileInputStream.open0(Native Method)
>         at java.io.FileInputStream.open(FileInputStream.java:195)
>         at java.io.FileInputStream.<init>(FileInputStream.java:138)
>         at java.io.FileInputStream.<init>(FileInputStream.java:93)
>         at
> sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
>         at
> sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
>         at java.net.URL.openStream(URL.java:1045)
>         at
> org.apache.logging.log4j.core.config.ConfigurationSource.fromUri(ConfigurationSource.java:247)
>         at
> org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:404)
>         at
> org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:346)
>         at
> org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:260)
>         at
> org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:615)
>         at
> org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:636)
>         at
> org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:231)
>         at
> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:153)
>         at
> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
>         at
> org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
>         at
> org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:121)
>         at
> org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:43)
>         at
> org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46)
>         at
> org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29)
>         at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
>         at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
>         at org.apache.solr.util.SolrCLI.<clinit>(SolrCLI.java:228)
> 
> Is there any other information I can provide?  You can download Solr at
> http://lucene.apache.org/solr if you need to reproduce and investigate
> the scripting that comes with it.
> 
> Thanks,
> Shawn
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 
> 



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

Reply via email to