jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Ekeland" <pekel...@credm.com>
Subject using log4J with JBoss and Cactus
Date Wed, 24 Jul 2002 15:53:28 GMT

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
	"------------ Standard Error -----------------
	log4j:WARN No appenders could be found for logger
	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




<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
	<!-- ================================= -->
	<!-- Preserve messages in a local file -->
	<!-- ================================= -->
	<!-- A time/date based rolling appender -->
	<appender name="FILE"
		<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"/>

	<!-- ============================== -->
	<!-- 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"/>

	<!-- ============================== -->
	<!-- 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"/>

	<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"/>

	<!-- ======================= -->
	<!-- Setup the loggers 		-->
	<!-- ======================= -->
	<logger name="com.credm.babel.cactus">
		<level value="DEBUG"/>
		<appender-ref ref="CACTUSTEST"/>
	<logger name="com.credm" additivity="false">
		<level value="WARN"/>
		<appender-ref ref="RUNTIME"/>
	<!-- ======================= -->
	<!-- Setup the Root category -->
	<!-- ======================= -->
		<appender-ref ref="CONSOLE"/>
		<appender-ref ref="FILE"/>


# Properties for configuring Log4j
# This is the configuring for logging on the JUnit side (i.e. the client

log4j.appender.cactus = org.apache.log4j.FileAppender
log4j.appender.cactus.File =
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

To unsubscribe, e-mail:   <mailto:cactus-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:cactus-user-help@jakarta.apache.org>

View raw message