title: log4j xml to write logs from one package to their own log file
body: <p>I'm sure this is simple but between Google and SO I haven't found the answer. </p>
  
  <p>I have a jboss 4.0.2 (I know it's old but I can't change it right now) webapp with log4j 1.2.9. I've set up logs for a console appender as well as a rolling file appender and they both work fine. </p>
  
  <p>I am trying to set up a log file that will log message coming from one packages (in my case, the com.sshtools package we use for SFTP). The main log fail and the console can also have these messages (or not, I really don't care). However, the ftp log should ONLY have messages from the com.sshtools package. Unfortunately, when I run the webapp, the FTP log gets all the messages instead of just the FTP ones.</p>
  
  <p>I am currently using categories to set levels for certain packages and using the appender-ref attribute. I have tried setting additivity to false for that package to no avail. I have tried switching the categories to loggers to no avail. I have tried setting appender-ref tags for all the packages (with them going to CONSOLE and FILE but not FTP) to no avail. </p>
  
  <p>I have seen responses for doing this with a properties file but NOT with an xml file. Since I don't know how to translate from a properties file to the xml file, those were not helpful to me.</p>
  
  <p>My log4j.xml is below:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"&gt;
  
  &lt;!-- ===================================================================== --&gt;
  &lt;!--                                                                       --&gt;
  &lt;!--  Log4j Configuration                                                  --&gt;
  &lt;!--                                                                       --&gt;
  &lt;!-- ===================================================================== --&gt;
  
  
  &lt;log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"&gt;
  
     &lt;!-- ================================= --&gt;
     &lt;!-- Preserve messages in a local file --&gt;
     &lt;!-- ================================= --&gt;
  
     &lt;!-- A time/date based rolling appender --&gt;
     &lt;appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender"&gt;
        &lt;errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/&gt;
        &lt;param name="File" value="${jboss.server.home.dir}/log/server.log"/&gt;
  
       &lt;param name="Append" value="true"/&gt;
       &lt;param name="MaxFileSize" value="20MB"/&gt;
       &lt;param name="MaxBackupIndex" value="50"/&gt;
  
        &lt;!-- Rollover at midnight each day --&gt;
       &lt;param name="DatePattern" value="'.'yyyy-MM-dd"/&gt;
  
  
        &lt;layout class="org.apache.log4j.PatternLayout"&gt;
           &lt;!-- The default pattern: Date Priority [Category] Message\n --&gt;
           &lt;param name="ConversionPattern" value="%d %-5p [%c] %m%n"/&gt;
  
        &lt;/layout&gt;
     &lt;/appender&gt;
  
     &lt;appender name="FTP" class="org.jboss.logging.appender.RollingFileAppender"&gt;
        &lt;errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/&gt;
        &lt;param name="File" value="${jboss.server.home.dir}/log/ftp.log"/&gt;
  
       &lt;param name="Append" value="true"/&gt;
       &lt;param name="MaxFileSize" value="20MB"/&gt;
       &lt;param name="MaxBackupIndex" value="50"/&gt;
  
        &lt;!-- Rollover at midnight each day --&gt;
        &lt;param name="DatePattern" value="'.'yyyy-MM-dd"/&gt;
  
  
        &lt;layout class="org.apache.log4j.PatternLayout"&gt;
           &lt;!-- The default pattern: Date Priority [Category] Message\n --&gt;
           &lt;param name="ConversionPattern" value="%d %-5p [%c] %m%n"/&gt;
  
        &lt;/layout&gt;
     &lt;/appender&gt;
  
     &lt;!-- ============================== --&gt;
     &lt;!-- Append messages to the console --&gt;
     &lt;!-- ============================== --&gt;
  
     &lt;appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"&gt;
        &lt;errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/&gt;
        &lt;param name="Target" value="System.out"/&gt;
        &lt;param name="Threshold" value="INFO"/&gt;
  
        &lt;layout class="org.apache.log4j.PatternLayout"&gt;
           &lt;!-- The default pattern: Date Priority [Category] Message\n --&gt;
           &lt;param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/&gt;
        &lt;/layout&gt;
     &lt;/appender&gt;
  
  
     &lt;!-- ================ --&gt;
     &lt;!-- Limit categories --&gt;
     &lt;!-- ================ --&gt;
  
     &lt;!-- Limit the org.apache category  --&gt;
     &lt;category name="org.apache"&gt;
        &lt;priority value="INFO"/&gt;
     &lt;/category&gt;
  
     &lt;!-- Limit the org.jgroups category  --&gt;
     &lt;category name="org.jgroups"&gt;
        &lt;priority value="WARN"/&gt;
     &lt;/category&gt;
  
     &lt;!-- Limit apache axis  --&gt;
     &lt;category name="org.jboss.axis"&gt;
        &lt;priority value="INFO"/&gt;
     &lt;/category&gt;
  
     &lt;!-- Limit JBoss categories --&gt;
     &lt;category name="org.jboss"&gt;
        &lt;priority value="INFO"/&gt;
     &lt;/category&gt;
  
     &lt;!-- Limit the JSR77 categories --&gt;
     &lt;category name="org.jboss.management"&gt;
        &lt;priority value="INFO"/&gt;
     &lt;/category&gt;
  
     &lt;!-- Limit j2ssh categories --&gt;
     &lt;category name="com.sshtools"&gt;
        &lt;priority value="WARN"/&gt;
        &lt;appender-ref ref="FTP"/&gt;
     &lt;/category&gt;
  
     &lt;!-- Limit Hibernate categories --&gt;
     &lt;category name="org.hibernate"&gt;
        &lt;priority value="ERROR"/&gt;
     &lt;/category&gt;
  
     &lt;!-- Limit mchange categories --&gt;
     &lt;category name="com.mchange"&gt;
        &lt;priority value="WARN"/&gt;
     &lt;/category&gt;
  
     &lt;!-- ======================= --&gt;
     &lt;!-- Setup the Root category --&gt;
     &lt;!-- ======================= --&gt;
  
     &lt;root&gt;
        &lt;appender-ref ref="CONSOLE"/&gt;
        &lt;appender-ref ref="FILE"/&gt;
        &lt;appender-ref ref="FTP"/&gt;
     &lt;/root&gt;
  
  
  &lt;/log4j:configuration&gt;
  </code></pre>
  
  <p>EDIT: I've tried reordering the categories and the tags within them (not that it should make a difference) and still no change. </p>