You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by ja...@jafurrer.ch on 2018/07/03 08:53:20 UTC

Logging fails when starting Solr in Windows using solr.cmd

Hi,

I was intending to open an Issue in Jira when I read that I'm supposed 
to first contact this mailinglist.

Problem description
==================

System: Microsoft Windows 10 Enterprise Version 10.0.16299 Build 16299

Steps to reproduce the problem:
1) Download solr-7.4.0.tgz
2) Unzip to C:\solr-7.4.0
3) No changes (configuration or otherwise) whatsoever
4) Open cmd.exe
5) Execute the following command: cd c:\solr-7.4.0\bin
6) Execute the following command: solr.cmd start -p 8983
7) The following console output appears:


c:\solr-7.4.0\bin>solr.cmd start -p 8983
ERROR StatusLogger Unable to access 
file:/c:/solr-7.4.0/server/file:c:/solr-7.4.0/server/scripts/cloud-scripts/log4j2.xml
  java.io.FileNotFoundException: 
c:\solr-7.4.0\server\file:c:\solr-7.4.0\server\scripts\cloud-scripts\log4j2.xml 
(Die Syntax für den Dateinamen, Verzeichnisnamen oder die 
Datenträgerbezeichnung ist falsch)
         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)
ERROR StatusLogger Unable to access 
file:/c:/solr-7.4.0/server/file:c:/solr-7.4.0/server/resources/log4j2.xml
  java.io.FileNotFoundException: 
c:\solr-7.4.0\server\file:c:\solr-7.4.0\server\resources\log4j2.xml (Die 
Syntax für den Dateinamen, Verzeichnisnamen oder die 
Datenträgerbezeichnung ist falsch)
         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.eclipse.jetty.util.log.Slf4jLog.<init>(Slf4jLog.java:38)
         at org.eclipse.jetty.util.log.Slf4jLog.<init>(Slf4jLog.java:32)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method)
         at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
         at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
         at 
java.lang.reflect.Constructor.newInstance(Constructor.java:423)
         at org.eclipse.jetty.util.log.Log.initialized(Log.java:178)
         at org.eclipse.jetty.util.log.Log.getLogger(Log.java:311)
         at org.eclipse.jetty.util.log.Log.getLogger(Log.java:301)
         at 
org.eclipse.jetty.xml.XmlConfiguration.<clinit>(XmlConfiguration.java:80)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
         at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
         at java.lang.reflect.Method.invoke(Method.java:498)
         at org.eclipse.jetty.start.Main.invokeMain(Main.java:220)
         at org.eclipse.jetty.start.Main.start(Main.java:486)
         at org.eclipse.jetty.start.Main.main(Main.java:77)
INFO  - 2018-07-03 10:12:19.375; 
org.apache.solr.util.configuration.SSLCredentialProviderFactory; 
Processing SSL Credential Provider chain: env;sysprop
Waiting up to 30 to see Solr running on port 8983
Started Solr server on port 8983. Happy searching!

c:\solr-7.4.0\bin>


8) I managed to fix the situation temporarily as follows (but I am not 
convinced this is the correct way to comprehensively tackle the problem)
    Edit C:\solr-7.4.0\bin\solr.cmd as follows:
    Change all occurrences of '-Dlog4j.configurationFile="file:' to 
'-Dlog4j.configurationFile="' (19 ocurrences in total)
    Change all occurrences of 'LOG4J_CONFIG=file:' to 'LOG4J_CONFIG=' (2 
ocurrences in total)


9) Execute the following command: solr.cmd restart -p 8983
10) The following console output appears:


c:\solr-7.4.0\bin>solr.cmd restart -p 8983
Stopping Solr process 20024 running on port 8983

Gewartet wird 0 Sekunden. Weiter mit beliebiger Taste...
INFO  - 2018-07-03 10:47:57.994; 
org.apache.solr.util.configuration.SSLCredentialProviderFactory; 
Processing SSL Credential Provider chain: env;sysprop
Waiting up to 30 to see Solr running on port 8983
Started Solr server on port 8983. Happy searching!

c:\solr-7.4.0\bin>


11) Can someone confirm this? Shall I open an issue?

Cheers,

Jakob

Re: Logging fails when starting Solr in Windows using solr.cmd

Posted by zac <is...@gmail.com>.
I did it success by remove 'file:'



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: Logging fails when starting Solr in Windows using solr.cmd

Posted by Erick Erickson <er...@gmail.com>.
The file:/// change was made in:
https://issues.apache.org/jira/browse/SOLR-12538, how to reconcile
these two?
On Sun, Sep 16, 2018 at 10:54 PM marcostocchi77@gmail.com
<ma...@gmail.com> wrote:
>
>
>
> On 2018/07/03 08:53:20, jakob@jafurrer.ch wrote:
> > Hi,
> >
> > I was intending to open an Issue in Jira when I read that I'm supposed
> > to first contact this mailinglist.
> >
> > Problem description
> > ==================
> >
> > System: Microsoft Windows 10 Enterprise Version 10.0.16299 Build 16299
> >
> > Steps to reproduce the problem:
> > 1) Download solr-7.4.0.tgz
> > 2) Unzip to C:\solr-7.4.0
> > 3) No changes (configuration or otherwise) whatsoever
> > 4) Open cmd.exe
> > 5) Execute the following command: cd c:\solr-7.4.0\bin
> > 6) Execute the following command: solr.cmd start -p 8983
> > 7) The following console output appears:
> >
> >
> > c:\solr-7.4.0\bin>solr.cmd start -p 8983
> > ERROR StatusLogger Unable to access
> > file:/c:/solr-7.4.0/server/file:c:/solr-7.4.0/server/scripts/cloud-scripts/log4j2.xml
> >   java.io.FileNotFoundException:
> > c:\solr-7.4.0\server\file:c:\solr-7.4.0\server\scripts\cloud-scripts\log4j2.xml
> > (Die Syntax für den Dateinamen, Verzeichnisnamen oder die
> > Datenträgerbezeichnung ist falsch)
> >          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)
> > ERROR StatusLogger Unable to access
> > file:/c:/solr-7.4.0/server/file:c:/solr-7.4.0/server/resources/log4j2.xml
> >   java.io.FileNotFoundException:
> > c:\solr-7.4.0\server\file:c:\solr-7.4.0\server\resources\log4j2.xml (Die
> > Syntax für den Dateinamen, Verzeichnisnamen oder die
> > Datenträgerbezeichnung ist falsch)
> >          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.eclipse.jetty.util.log.Slf4jLog.<init>(Slf4jLog.java:38)
> >          at org.eclipse.jetty.util.log.Slf4jLog.<init>(Slf4jLog.java:32)
> >          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> > Method)
> >          at
> > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> >          at
> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> >          at
> > java.lang.reflect.Constructor.newInstance(Constructor.java:423)
> >          at org.eclipse.jetty.util.log.Log.initialized(Log.java:178)
> >          at org.eclipse.jetty.util.log.Log.getLogger(Log.java:311)
> >          at org.eclipse.jetty.util.log.Log.getLogger(Log.java:301)
> >          at
> > org.eclipse.jetty.xml.XmlConfiguration.<clinit>(XmlConfiguration.java:80)
> >          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >          at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> >          at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >          at java.lang.reflect.Method.invoke(Method.java:498)
> >          at org.eclipse.jetty.start.Main.invokeMain(Main.java:220)
> >          at org.eclipse.jetty.start.Main.start(Main.java:486)
> >          at org.eclipse.jetty.start.Main.main(Main.java:77)
> > INFO  - 2018-07-03 10:12:19.375;
> > org.apache.solr.util.configuration.SSLCredentialProviderFactory;
> > Processing SSL Credential Provider chain: env;sysprop
> > Waiting up to 30 to see Solr running on port 8983
> > Started Solr server on port 8983. Happy searching!
> >
> > c:\solr-7.4.0\bin>
> >
> >
> > 8) I managed to fix the situation temporarily as follows (but I am not
> > convinced this is the correct way to comprehensively tackle the problem)
> >     Edit C:\solr-7.4.0\bin\solr.cmd as follows:
> >     Change all occurrences of '-Dlog4j.configurationFile="file:' to
> > '-Dlog4j.configurationFile="' (19 ocurrences in total)
> >     Change all occurrences of 'LOG4J_CONFIG=file:' to 'LOG4J_CONFIG=' (2
> > ocurrences in total)
> >
> >
> > 9) Execute the following command: solr.cmd restart -p 8983
> > 10) The following console output appears:
> >
> >
> > c:\solr-7.4.0\bin>solr.cmd restart -p 8983
> > Stopping Solr process 20024 running on port 8983
> >
> > Gewartet wird 0 Sekunden. Weiter mit beliebiger Taste...
> > INFO  - 2018-07-03 10:47:57.994;
> > org.apache.solr.util.configuration.SSLCredentialProviderFactory;
> > Processing SSL Credential Provider chain: env;sysprop
> > Waiting up to 30 to see Solr running on port 8983
> > Started Solr server on port 8983. Happy searching!
> >
> > c:\solr-7.4.0\bin>
> >
> >
> > 11) Can someone confirm this? Shall I open an issue?
> >
> > Cheers,
> >
> > Jakob
> >
> Hello,
>
> I experienced the same issue on Windows 10 professional. I don't think the OS version is important. The solr version might. I have solr-7.4.0.
> I decided to inspect the bin\solr.cmd file. At some point in the file I found the following instruction:
>
> IF NOT DEFINED LOG4J_CONFIG set "LOG4J_CONFIG=file:%SOLR_SERVER_DIR%\resources\log4j2.xml"
>
> To me the syntax sounds a bit cumbersome, but anyway, I decided to remove that "file:" before the env SOLR_SERVER_DIR, and I solved. So the final line is:
>
> IF NOT DEFINED LOG4J_CONFIG set "LOG4J_CONFIG=%SOLR_SERVER_DIR%\resources\log4j2.xml"
>
> A similar situation happens in many other instructions in the same solr.cmd file. I believe that we should remove that "file:" everywhere. Example:
> -Dlog4j.configurationFile="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j2.xml" ^
> instead:
> -Dlog4j.configurationFile="%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j2.xml" ^
>
> Hope this helps.
> Marco.

Re: Logging fails when starting Solr in Windows using solr.cmd

Posted by Oskar <o....@hima.com>.
I faced the same issue as jakob with solr-7.6.0, eclipse-2018-12 (4.10.0),
Java 1.8.0_191:

*Solution:*
In eclipse Run Configuration run-solr
remove "file:" from Argument
-Dlog4j.configurationFile="file:${workspace_loc:solr-7.6.0}/solr/server/resources/log4j2.xml"




--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: Logging fails when starting Solr in Windows using solr.cmd

Posted by Shawn Heisey <ap...@elyograg.org>.
On 9/16/2018 3:05 PM, marcostocchi77@gmail.com wrote:
> I experienced the same issue on Windows 10 professional. I don't think the OS version is important. The solr version might. I have solr-7.4.0.

The problem has been fixed in the source code and the next version of 
Solr (7.5.0) won't experience this issue.

https://issues.apache.org/jira/browse/SOLR-12538

We had a problem with Jira and ended up erasing all logs in Jira related 
to the change.  The git repository still has it.

https://git1-us-west.apache.org/repos/asf?p=lucene-solr.git;a=commit;h=93ae3669

Thanks,
Shawn


Re: Logging fails when starting Solr in Windows using solr.cmd

Posted by ma...@gmail.com, ma...@gmail.com.

On 2018/07/03 08:53:20, jakob@jafurrer.ch wrote: 
> Hi,
> 
> I was intending to open an Issue in Jira when I read that I'm supposed 
> to first contact this mailinglist.
> 
> Problem description
> ==================
> 
> System: Microsoft Windows 10 Enterprise Version 10.0.16299 Build 16299
> 
> Steps to reproduce the problem:
> 1) Download solr-7.4.0.tgz
> 2) Unzip to C:\solr-7.4.0
> 3) No changes (configuration or otherwise) whatsoever
> 4) Open cmd.exe
> 5) Execute the following command: cd c:\solr-7.4.0\bin
> 6) Execute the following command: solr.cmd start -p 8983
> 7) The following console output appears:
> 
> 
> c:\solr-7.4.0\bin>solr.cmd start -p 8983
> ERROR StatusLogger Unable to access 
> file:/c:/solr-7.4.0/server/file:c:/solr-7.4.0/server/scripts/cloud-scripts/log4j2.xml
>   java.io.FileNotFoundException: 
> c:\solr-7.4.0\server\file:c:\solr-7.4.0\server\scripts\cloud-scripts\log4j2.xml 
> (Die Syntax für den Dateinamen, Verzeichnisnamen oder die 
> Datenträgerbezeichnung ist falsch)
>          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)
> ERROR StatusLogger Unable to access 
> file:/c:/solr-7.4.0/server/file:c:/solr-7.4.0/server/resources/log4j2.xml
>   java.io.FileNotFoundException: 
> c:\solr-7.4.0\server\file:c:\solr-7.4.0\server\resources\log4j2.xml (Die 
> Syntax für den Dateinamen, Verzeichnisnamen oder die 
> Datenträgerbezeichnung ist falsch)
>          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.eclipse.jetty.util.log.Slf4jLog.<init>(Slf4jLog.java:38)
>          at org.eclipse.jetty.util.log.Slf4jLog.<init>(Slf4jLog.java:32)
>          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
> Method)
>          at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>          at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>          at 
> java.lang.reflect.Constructor.newInstance(Constructor.java:423)
>          at org.eclipse.jetty.util.log.Log.initialized(Log.java:178)
>          at org.eclipse.jetty.util.log.Log.getLogger(Log.java:311)
>          at org.eclipse.jetty.util.log.Log.getLogger(Log.java:301)
>          at 
> org.eclipse.jetty.xml.XmlConfiguration.<clinit>(XmlConfiguration.java:80)
>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>          at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>          at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>          at java.lang.reflect.Method.invoke(Method.java:498)
>          at org.eclipse.jetty.start.Main.invokeMain(Main.java:220)
>          at org.eclipse.jetty.start.Main.start(Main.java:486)
>          at org.eclipse.jetty.start.Main.main(Main.java:77)
> INFO  - 2018-07-03 10:12:19.375; 
> org.apache.solr.util.configuration.SSLCredentialProviderFactory; 
> Processing SSL Credential Provider chain: env;sysprop
> Waiting up to 30 to see Solr running on port 8983
> Started Solr server on port 8983. Happy searching!
> 
> c:\solr-7.4.0\bin>
> 
> 
> 8) I managed to fix the situation temporarily as follows (but I am not 
> convinced this is the correct way to comprehensively tackle the problem)
>     Edit C:\solr-7.4.0\bin\solr.cmd as follows:
>     Change all occurrences of '-Dlog4j.configurationFile="file:' to 
> '-Dlog4j.configurationFile="' (19 ocurrences in total)
>     Change all occurrences of 'LOG4J_CONFIG=file:' to 'LOG4J_CONFIG=' (2 
> ocurrences in total)
> 
> 
> 9) Execute the following command: solr.cmd restart -p 8983
> 10) The following console output appears:
> 
> 
> c:\solr-7.4.0\bin>solr.cmd restart -p 8983
> Stopping Solr process 20024 running on port 8983
> 
> Gewartet wird 0 Sekunden. Weiter mit beliebiger Taste...
> INFO  - 2018-07-03 10:47:57.994; 
> org.apache.solr.util.configuration.SSLCredentialProviderFactory; 
> Processing SSL Credential Provider chain: env;sysprop
> Waiting up to 30 to see Solr running on port 8983
> Started Solr server on port 8983. Happy searching!
> 
> c:\solr-7.4.0\bin>
> 
> 
> 11) Can someone confirm this? Shall I open an issue?
> 
> Cheers,
> 
> Jakob
> 
Hello,

I experienced the same issue on Windows 10 professional. I don't think the OS version is important. The solr version might. I have solr-7.4.0. 
I decided to inspect the bin\solr.cmd file. At some point in the file I found the following instruction:

IF NOT DEFINED LOG4J_CONFIG set "LOG4J_CONFIG=file:%SOLR_SERVER_DIR%\resources\log4j2.xml"

To me the syntax sounds a bit cumbersome, but anyway, I decided to remove that "file:" before the env SOLR_SERVER_DIR, and I solved. So the final line is:

IF NOT DEFINED LOG4J_CONFIG set "LOG4J_CONFIG=%SOLR_SERVER_DIR%\resources\log4j2.xml"

A similar situation happens in many other instructions in the same solr.cmd file. I believe that we should remove that "file:" everywhere. Example:
-Dlog4j.configurationFile="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j2.xml" ^
instead:
-Dlog4j.configurationFile="%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j2.xml" ^

Hope this helps. 
Marco.

Re: Logging fails when starting Solr in Windows using solr.cmd

Posted by Erick Erickson <er...@gmail.com>.
Shawn:

Yeah, the best I've been able to come up with so far is to have
exactly two, both in server/resources
log4j2.xml - the standard configuration for running Solr
log4j2-console.xml Used by the startup scripts (_not_ running Solr).

See the last two comments on SOLR-12008 for more detail.

Erick


On Tue, Jul 3, 2018 at 12:07 PM, Shawn Heisey <ap...@elyograg.org> wrote:
> On 7/3/2018 2:53 AM, jakob@jafurrer.ch wrote:
>> I was intending to open an Issue in Jira when I read that I'm supposed
>> to first contact this mailinglist.
>>
>> Problem description
>> ==================
>>
>> System: Microsoft Windows 10 Enterprise Version 10.0.16299 Build 16299
>>
>> Steps to reproduce the problem:
>> 1) Download solr-7.4.0.tgz
>> 2) Unzip to C:\solr-7.4.0
>> 3) No changes (configuration or otherwise) whatsoever
>> 4) Open cmd.exe
>> 5) Execute the following command: cd c:\solr-7.4.0\bin
>> 6) Execute the following command: solr.cmd start -p 8983
>> 7) The following console output appears:
>>
>> c:\solr-7.4.0\bin>solr.cmd start -p 8983
>> ERROR StatusLogger Unable to access
>> file:/c:/solr-7.4.0/server/file:c:/solr-7.4.0/server/scripts/cloud-scripts/log4j2.xml
>
> I'm seeing the same behavior on Windows 7.  I started with the .zip
> download, so the fact that you have the .tgz download is likely not a
> factor.  The .zip is a better option for Windows -- it has correct line
> endings for Windows in most files, and Windows knows how to extract it
> without installing additional software.
>
> This is looking to me like a probable windows-specific bug in log4j2.  I
> have asked the log4j mailing list about it.  The solr.cmd script appears
> to be functioning correctly and not producing the strange pathname shown
> in the error, and the same parameter syntax (with the file: prefix) is
> working correctly on Linux.
>
> Erick, the config in cloud-scripts logs to stderr rather than files.
> I'm all for moving it to resources so we don't have to keep track of
> logging config files in multiple locations, but it does need to be a
> different config file specifically for command-line tools.  Perhaps
> log4j2-cli.xml as the filename?
>
> This is the first version of Solr that includes log4j2.  All previous
> releases used log4j 1.2.x.  Operating systems like Linux and MacOS get a
> lot more testing than Windows does.  It's not good that this problem
> exists.  Thank you for finding a workaround.
>
> Solr 7.4 is using the most current version of log4j that is currently
> available.
>
> If you would like to proceed, please feel free to open an issue in
> Jira.  A suggested title for the issue would be "log4j exceptions during
> startup on Windows".  Even though I think this is a bug in software
> other than Solr, it is a problem that Solr is experiencing, so we need
> to track it and make sure we fix it.  It might end up being a two-part
> fix, where we initially apply your workaround and then later revert that
> change and upgrade log4j.
>
> Thanks,
> Shawn
>

Re: Logging fails when starting Solr in Windows using solr.cmd

Posted by Shawn Heisey <ap...@elyograg.org>.
On 7/3/2018 2:53 AM, jakob@jafurrer.ch wrote:
> I was intending to open an Issue in Jira when I read that I'm supposed
> to first contact this mailinglist.
>
> Problem description
> ==================
>
> System: Microsoft Windows 10 Enterprise Version 10.0.16299 Build 16299
>
> Steps to reproduce the problem:
> 1) Download solr-7.4.0.tgz
> 2) Unzip to C:\solr-7.4.0
> 3) No changes (configuration or otherwise) whatsoever
> 4) Open cmd.exe
> 5) Execute the following command: cd c:\solr-7.4.0\bin
> 6) Execute the following command: solr.cmd start -p 8983
> 7) The following console output appears:
>
> c:\solr-7.4.0\bin>solr.cmd start -p 8983
> ERROR StatusLogger Unable to access
> file:/c:/solr-7.4.0/server/file:c:/solr-7.4.0/server/scripts/cloud-scripts/log4j2.xml

I'm seeing the same behavior on Windows 7.  I started with the .zip
download, so the fact that you have the .tgz download is likely not a
factor.  The .zip is a better option for Windows -- it has correct line
endings for Windows in most files, and Windows knows how to extract it
without installing additional software.

This is looking to me like a probable windows-specific bug in log4j2.  I
have asked the log4j mailing list about it.  The solr.cmd script appears
to be functioning correctly and not producing the strange pathname shown
in the error, and the same parameter syntax (with the file: prefix) is
working correctly on Linux.

Erick, the config in cloud-scripts logs to stderr rather than files. 
I'm all for moving it to resources so we don't have to keep track of
logging config files in multiple locations, but it does need to be a
different config file specifically for command-line tools.  Perhaps
log4j2-cli.xml as the filename?

This is the first version of Solr that includes log4j2.  All previous
releases used log4j 1.2.x.  Operating systems like Linux and MacOS get a
lot more testing than Windows does.  It's not good that this problem
exists.  Thank you for finding a workaround.

Solr 7.4 is using the most current version of log4j that is currently
available.

If you would like to proceed, please feel free to open an issue in
Jira.  A suggested title for the issue would be "log4j exceptions during
startup on Windows".  Even though I think this is a bug in software
other than Solr, it is a problem that Solr is experiencing, so we need
to track it and make sure we fix it.  It might end up being a two-part
fix, where we initially apply your workaround and then later revert that
change and upgrade log4j.

Thanks,
Shawn


Re: Logging fails when starting Solr in Windows using solr.cmd

Posted by Erick Erickson <er...@gmail.com>.
Jakob:

I don't have Windows so rely on people who do to vet changes. But I'm
working on https://issues.apache.org/jira/browse/SOLR-12008 which
seeks to get rid of the confusing number of log4j config files and
solr.cmd has a lot of paths to change. So if you do get agreement that
you should raise a JIRA would you please link it to 12008? The "More"
drop-down has a "Link" option.....

The (tentative) place where the "one true" log4j config file will
reside is in ...server/resources, so if people work this script over
using that one would help... And if it's impossible to use that one
that'd also be good information.

Thanks,
Erick

On Tue, Jul 3, 2018 at 1:53 AM,  <ja...@jafurrer.ch> wrote:
> Hi,
>
> I was intending to open an Issue in Jira when I read that I'm supposed to
> first contact this mailinglist.
>
> Problem description
> ==================
>
> System: Microsoft Windows 10 Enterprise Version 10.0.16299 Build 16299
>
> Steps to reproduce the problem:
> 1) Download solr-7.4.0.tgz
> 2) Unzip to C:\solr-7.4.0
> 3) No changes (configuration or otherwise) whatsoever
> 4) Open cmd.exe
> 5) Execute the following command: cd c:\solr-7.4.0\bin
> 6) Execute the following command: solr.cmd start -p 8983
> 7) The following console output appears:
>
>
> c:\solr-7.4.0\bin>solr.cmd start -p 8983
> ERROR StatusLogger Unable to access
> file:/c:/solr-7.4.0/server/file:c:/solr-7.4.0/server/scripts/cloud-scripts/log4j2.xml
>  java.io.FileNotFoundException:
> c:\solr-7.4.0\server\file:c:\solr-7.4.0\server\scripts\cloud-scripts\log4j2.xml
> (Die Syntax für den Dateinamen, Verzeichnisnamen oder die
> Datenträgerbezeichnung ist falsch)
>         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)
> ERROR StatusLogger Unable to access
> file:/c:/solr-7.4.0/server/file:c:/solr-7.4.0/server/resources/log4j2.xml
>  java.io.FileNotFoundException:
> c:\solr-7.4.0\server\file:c:\solr-7.4.0\server\resources\log4j2.xml (Die
> Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung
> ist falsch)
>         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.eclipse.jetty.util.log.Slf4jLog.<init>(Slf4jLog.java:38)
>         at org.eclipse.jetty.util.log.Slf4jLog.<init>(Slf4jLog.java:32)
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>         at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>         at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>         at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
>         at org.eclipse.jetty.util.log.Log.initialized(Log.java:178)
>         at org.eclipse.jetty.util.log.Log.getLogger(Log.java:311)
>         at org.eclipse.jetty.util.log.Log.getLogger(Log.java:301)
>         at
> org.eclipse.jetty.xml.XmlConfiguration.<clinit>(XmlConfiguration.java:80)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at org.eclipse.jetty.start.Main.invokeMain(Main.java:220)
>         at org.eclipse.jetty.start.Main.start(Main.java:486)
>         at org.eclipse.jetty.start.Main.main(Main.java:77)
> INFO  - 2018-07-03 10:12:19.375;
> org.apache.solr.util.configuration.SSLCredentialProviderFactory; Processing
> SSL Credential Provider chain: env;sysprop
> Waiting up to 30 to see Solr running on port 8983
> Started Solr server on port 8983. Happy searching!
>
> c:\solr-7.4.0\bin>
>
>
> 8) I managed to fix the situation temporarily as follows (but I am not
> convinced this is the correct way to comprehensively tackle the problem)
>    Edit C:\solr-7.4.0\bin\solr.cmd as follows:
>    Change all occurrences of '-Dlog4j.configurationFile="file:' to
> '-Dlog4j.configurationFile="' (19 ocurrences in total)
>    Change all occurrences of 'LOG4J_CONFIG=file:' to 'LOG4J_CONFIG=' (2
> ocurrences in total)
>
>
> 9) Execute the following command: solr.cmd restart -p 8983
> 10) The following console output appears:
>
>
> c:\solr-7.4.0\bin>solr.cmd restart -p 8983
> Stopping Solr process 20024 running on port 8983
>
> Gewartet wird 0 Sekunden. Weiter mit beliebiger Taste...
> INFO  - 2018-07-03 10:47:57.994;
> org.apache.solr.util.configuration.SSLCredentialProviderFactory; Processing
> SSL Credential Provider chain: env;sysprop
> Waiting up to 30 to see Solr running on port 8983
> Started Solr server on port 8983. Happy searching!
>
> c:\solr-7.4.0\bin>
>
>
> 11) Can someone confirm this? Shall I open an issue?
>
> Cheers,
>
> Jakob