I read the Wiki page on logging (http://www.jboss.org/wiki/Wiki.jsp?page=Logging) and wanted to use the TCLFilter but could not get it to work. I used the sample log4j.xml config entries and the log file would be created but nothing was written to it. For the DeployURL I was using the name of my war file, which is not packaged in an ear. I tried various things, but the only thing that worked was removing the ".war" part of the file name for the DeployURL parameter. Once I did that, logging from my application was written to the file I specified.
My question is, is the Wiki wrong, is the DeployURL supposed to be different for war's versus ear's, or am I just doing something wrong?
My log4j.xml config snippet:
<appender name="MyApp1" class="org.jboss.logging.appender.DailyRollingFileAppender"> <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/> <param name="File" value="${jboss.server.home.dir}/log/MyApp1.xml"/> <param name="Append" value="false"/> <!-- Rollover at midnight each day --> <param name="DatePattern" value="'.'yyyy-MM-dd"/> <layout class="org.apache.log4j.xml.XMLLayout"/> <filter class="org.jboss.logging.filter.TCLFilter"> <param name="AcceptOnMatch" value="true"/> <!-- The war file is actually named "MyApp1.war". --> <param name="DeployURL" value="MyApp1"/> </filter> </appender> <root> <appender-ref ref="CONSOLE"/> <appender-ref ref="FILE"/> <appender-ref ref="MyApp1"/> </root>
I have experienced the same behaviour in JBoss 4.0.4 GA.
I'm not sure the TCLFilter works properly though as i periodically seem to get output from other apps appearing in specific log files.
Has anyone else got this working 100% OK??
Cheers,
Stuart