Log4j2 use XInclude from within an executable jar

Viewed 641

I have 2 Webapps and an executable jar (3 in total) all using a very similar log4j2 set up.

All 3 apps look like the following

<configuration status="OFF" xmlns:xi="http://www.w3.org/2001/XInclude">
 <Properties>
   <Property name="logfile-name">LOGNAME.log</Property>
   <Property name="logfile-folder">/home/${env:PUID}/utm/logs</Property>   
   <Property name="console-pattern">%d [%-6p] %C{1}.%M(%L) - %msg %n</Property>
   <Property name="logfile-pattern">%d [%-6p] %C{1}.%M - %msg %n</Property>    
   <Property name="max-log-size">100 MB</Property>
   <Property name="max-log-keep">12</Property>
   <Property name="rolling-interval">1</Property>
 </Properties>   

  <xi:include href="/opt/app/jtm/conf/jtm-log4j-appenders.xml" />
  <xi:include href="/opt/app/jtm/conf/jtm-log4j-loggers.xml" />
</configuration>

Properties are passed into the appenders.xml and loggers.xml for all projects. It works fine for the Webapps.

The executable jarfile reports this error

[Warning] log4j2.xml:23:66: Include operation failed, reverting to fallback. Resource error reading file as XML (href='/opt/app/jtm/conf/jtm-log4j-appenders.xml'). Reason: no !/ in spec

[Fatal Error] log4j2.xml:23:66: An include with href '/opt/app/jtm/conf/jtm-log4j-appenders.xml'failed, and no fallback element was found.

ERROR StatusLogger Error parsing jar:file:/C:/Workspaces/JTM/jtm-irtransferfile/dist/irtransferfile.jar!/log4j2.xml
     org.xml.sax.SAXParseException; systemId: jar:file:/C:/Workspaces/JTM/jtm-irtransferfile/dist/irtransferfile.jar!/log4j2.xml; lineNumber: 23; columnNumber: 66; An include with href '/opt/app/jtm/conf/jtm-log4j-appenders.xml'failed, and no fallback element was found.

I've looked in a few places on the web and there is nothing outright to answer this. I do get the feeling that it might be due to the executable jar reading from the file system but I'm struggling a little.

0 Answers
Related