2 Replies Latest reply on Sep 17, 2004 2:56 AM by frito

    Include external xml file within log4j

    cexp11

      I want to create a seperate log file for each deployed webapp. I do not want to add the details of each appender and category to log4j.xml. I want each webapp owner to create a separate xml file with the appender and category definitions, and include this xml file in log4j.xml. I have tried the following:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"
      [ENTITY app SYSTEM "appender.xml"
       ENTITY cat SYSTEM "category.xml"
       ]>
      
      <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
      
       <!-- ============================== -->
       <!-- Write messages to a file -->
       <!-- ============================== -->
      
      &app;
      
       <!-- A time/date based rolling appender -->
       <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
       <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
       <param name="Append" value="true"/>
      
      { rest of appender definitions here }
      
       <!-- ============================== -->
       <!-- Limit categories -->
       <!-- ============================== -->
      
       <category name="com">
       <priority value="WARN"/>
       </category>
      
       <category name="org">
       <priority value="WARN"/>
       </category>
      
      { rest of category definitions here }
      
      &cat;
      
      { rest of log4j.xml here }
      
      </log4j:configuration>
      
      


      I get the following error and no server.log is created, only boot.log:

      [2004-07-27 09:37:39] 09:37:39,349 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resource:log4j.xml
      [2004-07-27 09:37:39] log4j:ERROR Could not parse input source [org.xml.sax.InputSource@bcda2d].
      [2004-07-27 09:37:39] java.net.MalformedURLException: unknown protocol: dummy
      [2004-07-27 09:37:39] at java.net.URL.(URL.java:544)
      [2004-07-27 09:37:39] at java.net.URL.(URL.java:434)
      [2004-07-27 09:37:39] at java.net.URL.(URL.java:383)
      [2004-07-27 09:37:39] at org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.java:740)