Hi Paul, With Cactus 1.3, you have to provide a cactus_client.properties and cactus_server.properties files. You cannot use an XML one as Cactus is not using Log4J DOMConfigurator.
The config files that are driving are Cactus ones (as the test are under the control of Cactus). Thus you need to add your appenders to the Cactus properties files. The Cactus files are empty because Cactus only logs statements in DEBUG mode (and by default the level is WARN in cactus_client and cactus_server.properties). That said, we have changed this mechanism in Cactus 1.4 (not release yet but available from CVS and nightly builds). Cactus is now using Jakarta Commons Logging and is completely log system agnostic, including for configurations. So you could simply drop your log4j.xml in your classpath, adding the cactus categories if you wish. Thanks -Vincent > -----Original Message----- > From: Paul Ekeland [mailto:[EMAIL PROTECTED]] > Sent: 24 July 2002 16:53 > To: [EMAIL PROTECTED] > Subject: using log4J with JBoss and Cactus > > > Hello everyone, > > I am currently writing a program to test my EJBs using Cactus. I created a > war file of the cactus tests and they run on a JBoss 3.0 platform. JBoss, > Cactus and my program are all using log4J... Here is how it is written so > far: I followed your recommandations and so I adapted the log4j.xml of > JBoss > and inserted my own appenders and loggers as shown in appendix. > > Now, Cactus also is using log4J and needs 2 configuration files, > log_client.properties and log_server.properties . log_client.properties is > described in the appendix too. > > With this setup, here is what i get: > > * 2 empty logfiles cactus_client.log and cactus_server.log even > though the > code requires some events to be written in them. At least, it seems > it > reads correctly the configuration files from Cactus. > > * an appender error that should not have happened if the appenders i > had > put in the configuration file of JBoss, log4J.xml, had been taken in > account: > "------------ Standard Error ----------------- > log4j:WARN No appenders could be found for logger > (com.credm.babel.cactus.TestPropertyType). > log4j:WARN Please initialize the log4j system properly. > ------------- ---------------- ---------------" > > * No files are created for the CACTUSTEST appender.. > > I'm a bit lost to be honest between all this, so if you could help me I > would greatly appreciate it.. I'm not sure but I think there could be some > issues with log4J's JBoss and log4J's war file being in different > classloaders... > > Thanks! > > Paul > > ========== > log4j.xml: > ========== > > <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" > debug="true"> > <!-- ================================= --> > <!-- Preserve messages in a local file --> > <!-- ================================= --> > <!-- 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="false"/> > <param name="DatePattern" value="'.'yyyy-MM-dd"/> > <layout class="org.apache.log4j.PatternLayout"> > <!-- The default pattern: Date Priority [Category] > Message\n --> > <param name="ConversionPattern" value="%d %-5p [%c] > %m%n"/> > </layout> > </appender> > > <!-- ============================== --> > <!-- Append messages to the console --> > <!-- ============================== --> > <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> > <param name="Threshold" value="INFO"/> > <param name="Target" > value="${jboss.server.home.dir}/log/system.out"/> > <layout class="org.apache.log4j.PatternLayout"> > <!-- The default pattern: Date Priority [Category] > Message\n --> > <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p > [%c{1}] %m%n"/> > </layout> > > <!-- ============================== --> > <!-- My appenders --> > <!-- ============================== --> > <appender name="CACTUSTEST" class="org.apache.log4j.FileAppender"> > <param name="File" > value="${jboss.server.home.dir}/log/cactusTest.log"/> > <!--param name="threshold" value="INFO"/--> > <layout class="org.apache.log4j.PatternLayout"> > <param name="ConversionPattern" value="=(%-35c{2} %-4L) > %m%n"/> > </layout> > </appender> > > <appender name="RUNTIME" class="org.apache.log4j.FileAppender"> > <param name="File" > value="${jboss.server.home.dir}/log/runtime.log"/> > <param name="threshold" value="INFO"/> > <layout class="org.apache.log4j.PatternLayout"> > <param name="ConversionPattern" value="=(%-35c{2} %-4L) > %m%n"/> > </layout> > </appender> > > > <!-- ======================= --> > <!-- Setup the loggers --> > <!-- ======================= --> > <logger name="com.credm.babel.cactus"> > <level value="DEBUG"/> > <appender-ref ref="CACTUSTEST"/> > </logger> > <logger name="com.credm" additivity="false"> > <level value="WARN"/> > <appender-ref ref="RUNTIME"/> > </logger> > <!-- ======================= --> > <!-- Setup the Root category --> > <!-- ======================= --> > <root> > <appender-ref ref="CONSOLE"/> > <appender-ref ref="FILE"/> > </root> > </log4j:configuration> > > > ====================== > log_client.properties: > ====================== > > # Properties for configuring Log4j > # This is the configuring for logging on the JUnit side (i.e. the client > side) > > log4j.appender.cactus = org.apache.log4j.FileAppender > log4j.appender.cactus.File = > D:/applications/jboss-3.0.0_tomcat- > 4.0.3/server/default/log/cactus_client.lo > g > log4j.appender.cactus.Append = false > log4j.appender.cactus.layout = org.apache.log4j.PatternLayout > log4j.appender.cactus.layout.ConversionPattern = %d{ABSOLUTE} [%t] %-5p > %-30.30c{2} %x - %m %n > > # Any application log which uses Log4J will be logged to the Cactus log > file > # log4j.rootCategory=DEBUG, cactus > log4j.rootlogger=DEBUG, cactus > > # By default we don't log at the DEBUG level for Cactus log, in order not > to > generate too > # many logs. However, should a problem arise and logs need to be sent to > the > Cactus dev team, > # then we will ask you to change this to DEBUG. > log4j.logger.org.apache.cactus = INFO, cactus > log4j.additivity.org.apache.cactus=false > > > -- > To unsubscribe, e-mail: <mailto:cactus-user- > [EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:cactus-user- > [EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
