-Xlog,..,file=filename with absolute path on windows?

Uwe Schindler uschindler at apache.org
Sun Aug 20 19:55:38 UTC 2017


I am currently adapting Apache Solr's startup scripts for Java 9. Linux was already done at the beginning of this year and works perfectly, but Windows brings some problems. I already fixed version number parsing, but I stumbled on the following: In the Windows ".cmd" shell script it uses the following to enable Garbage collection logging to a separate file, if Java 9 is detected:
    set GC_LOG_OPTS="-Xlog:gc*:file=!SOLR_LOGS_DIR!\solr_gc.log:time,uptime:filecount=9,filesize=20000"

The problem is now that "!SOLR_LOGS_DIR!" is already expanded to an absolute Windows Path by the shell and therefore starts with "C:\". The problem is now the colon, which breaks the log parsing. When Java 9 starts it exits with the following parsing error:
Invalid -Xlog option '-Xlog:gc*:file=C:\Users\Uwe Schindler\Projects\lucene\trunk-lusolr1\solr\server\logs\solr_gc.log:time,uptime:filecount=9,filesize=20000'

If I replace with a simple file name, without path/drive letter it works. How to escape the colon in the drive letter correctly, to me this looks like a bummer?


Uwe Schindler
uschindler at apache.org 
ASF Member, Apache Lucene PMC / Committer
Bremen, Germany

More information about the hotspot-dev mailing list