You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2003/10/19 20:15:31 UTC
cvs commit: jakarta-cactus/samples/servlet logging_client.properties.sample logging_server.properties.sample build.xml build.properties.sample .cvsignore
vmassol 2003/10/19 11:15:31
Modified: samples/servlet/src/scripts/share build.xml
samples/servlet build.xml build.properties.sample .cvsignore
Added: samples/servlet logging_client.properties.sample
logging_server.properties.sample
Log:
Make logging system really work. Tested with JDK 1.4, Log4j and simple logging. Also tested with several app server
Revision Changes Path
1.25 +41 -1 jakarta-cactus/samples/servlet/src/scripts/share/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-cactus/samples/servlet/src/scripts/share/build.xml,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- build.xml 13 Oct 2003 20:51:37 -0000 1.24
+++ build.xml 19 Oct 2003 18:15:31 -0000 1.25
@@ -111,6 +111,12 @@
location="../../lib/@junit.jar.name@"/>
<property name="nekohtml.jar"
location="../../lib/@nekohtml.jar.name@"/>
+
+ <!-- This is optional and only needed if you wish to debug and use
+ Log4J for logging -->
+ <property name="log4j.jar"
+ location="../../lib/@log4j.jar.name@"/>
+
<path id="cactus.classpath">
<path refid="project.classpath"/>
<pathelement location="${aspectjrt.jar}"/>
@@ -236,7 +242,32 @@
"cactus.home.[container name]" has been defined.
========================================================================
-->
- <target name="test.prepare" depends="war, compile.cactus">
+ <target name="test.prepare.logging">
+
+ <!-- Convert the path to logging_*.properties to use forward slashes
+ so that it works when loaded as a String in Java (backslashes
+ won't work. -->
+ <pathconvert property="target.dir.normalized" dirsep="/">
+ <path>
+ <pathelement location="${target.dir}"/>
+ </path>
+ </pathconvert>
+ <copy todir="${target.dir}" filtering="on" failonerror="false">
+ <fileset dir="${base.dir}">
+ <include name="logging_*.properties"/>
+ </fileset>
+ <filterset>
+ <filter token="target.dir" value="${target.dir.normalized}"/>
+ </filterset>
+ </copy>
+ <!-- Make sure logging_*.properties files exist, even if empty -->
+ <touch file="${target.dir}/logging_client.properties"/>
+ <touch file="${target.dir}/logging_server.properties"/>
+
+ </target>
+
+ <target name="test.prepare"
+ depends="war, compile.cactus, test.prepare.logging">
<!-- Cactify the web-app archive -->
<cactifywar srcfile="${target.dir}/${project.name.file}.war"
@@ -244,6 +275,7 @@
mergewebxml="${src.webapp.dir}/WEB-INF/cactus-web.xml">
<classes dir="${target.classes.cactus.dir}"/>
<lib file="${httpunit.jar}"/>
+ <lib file="${log4j.jar}"/>
<!-- Provide a secured servlet redirector in addition to the
default servlet redirector -->
<servletredirector/>
@@ -282,6 +314,13 @@
<!-- Run the tests -->
<cactus warfile="${target.dir}/test.war" fork="yes"
failureproperty="tests.failed" haltonerror="true">
+
+ <!-- Configure the cactus task for logging -->
+ <cactusproperty server="false"
+ propertiesFile="${target.dir.normalized}/logging_client.properties"/>
+ <cactusproperty server="true"
+ propertiesFile="${target.dir.normalized}/logging_server.properties"/>
+
<classpath>
<path refid="project.classpath"/>
<@clover.begin@pathelement location="${clover.jar}"/@clover.end@>
@@ -289,6 +328,7 @@
<pathelement location="${nekohtml.jar}"/>
<pathelement location="${target.classes.java.dir}"/>
<pathelement location="${target.classes.cactus.dir}"/>
+ <pathelement location="${log4j.jar}"/>
</classpath>
<containerset>
<@j2ee13.begin@jboss3x if="cactus.home.jboss3x"
1.37 +11 -1 jakarta-cactus/samples/servlet/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-cactus/samples/servlet/build.xml,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- build.xml 13 Jul 2003 15:29:59 -0000 1.36
+++ build.xml 19 Oct 2003 18:15:31 -0000 1.37
@@ -136,6 +136,7 @@
<basename property="httpunit.jar.name" file="${httpunit.jar}"/>
<basename property="junit.jar.name" file="${junit.jar}"/>
<basename property="nekohtml.jar.name" file="${nekohtml.jar}"/>
+ <basename property="log4j.jar.name" file="${log4j.jar}"/>
<filterset id="jar.names">
<filter token="jstl.jar.name" value="${jstl.jar.name}"/>
@@ -151,6 +152,7 @@
<filter token="httpunit.jar.name" value="${httpunit.jar.name}"/>
<filter token="junit.jar.name" value="${junit.jar.name}"/>
<filter token="nekohtml.jar.name" value="${nekohtml.jar.name}"/>
+ <filter token="log4j.jar.name" value="${log4j.jar.name}"/>
</filterset>
</target>
@@ -192,6 +194,7 @@
<available file="${commons.logging.jar}"/>
<available file="${httpunit.jar}"/>
<available file="${j2ee.jar}"/>
+ <available file="${log4j.jar}"/>
<or>
<not>
<isset property="j2ee13.available"/>
@@ -268,6 +271,13 @@
<!-- Copy README file -->
<copy todir="${target.sample.dir}" file="${base.dir}/README"/>
+ <!-- Copy sample logging properties file -->
+ <copy todir="${target.sample.dir}">
+ <fileset dir="${base.dir}">
+ <include name="logging_*.properties.sample"/>
+ </fileset>
+ </copy>
+
</target>
<target name="sample.clover" depends="sample.main" if="clover.enable">
1.14 +4 -1 jakarta-cactus/samples/servlet/build.properties.sample
Index: build.properties.sample
===================================================================
RCS file: /home/cvs/jakarta-cactus/samples/servlet/build.properties.sample,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- build.properties.sample 12 Sep 2003 11:56:44 -0000 1.13
+++ build.properties.sample 19 Oct 2003 18:15:31 -0000 1.14
@@ -31,6 +31,9 @@
# The location of the JSTL jar
standard.jar = ${lib.repo}/taglibs/jars/standard-1.0.2.jar
+# The location of the log4j jar
+log4j.jar = ${lib.repo}/log4j/jars/log4j-1.2.8.jar
+
# -----------------------------------------------------------------------------
# Optional properties
# -----------------------------------------------------------------------------
1.2 +2 -0 jakarta-cactus/samples/servlet/.cvsignore
Index: .cvsignore
===================================================================
RCS file: /home/cvs/jakarta-cactus/samples/servlet/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore 3 Feb 2003 08:37:35 -0000 1.1
+++ .cvsignore 19 Oct 2003 18:15:31 -0000 1.2
@@ -6,3 +6,5 @@
release-12
release-13
ant.bat
+logging_client.properties
+logging_server.properties
1.1 jakarta-cactus/samples/servlet/logging_client.properties.sample
Index: logging_client.properties.sample
===================================================================
# -----------------------------------------------------------------------------
# Logging properties
# -----------------------------------------------------------------------------
# Disable logging by default when running the tests. If you wish to use a
# logging subsystem, uncomment the line below. That will let Commons logging
# decide automatically of a suitable logging system for you. You can also force
# commons-logging to use a specific logging system. For more info, see
# http://jakarta.apache.org/commons/logging/api/org/apache/commons/logging/package-summary.html#package_description
# Disable logging
#org.apache.commons.logging.Log = org.apache.commons.logging.impl.NoOpLog
# Force to use JDK 1.4 logging
#org.apache.commons.logging.Log = org.apache.commons.logging.impl.Jdk14Logger
# Force to use Log4J logging
#org.apache.commons.logging.Log = org.apache.commons.logging.impl.Log4JLogger
# Force to use Simple logging
#org.apache.commons.logging.Log = org.apache.commons.logging.impl.SimpleLog
# ---- JDK 1.4 logging properties
# Following properties are useful if you're using the JDK 1.4 logging subsystem
# and wish to output logs to a file. Make sure to comment out the NoOpLog line
# above.
java.util.logging.config.file = @target.dir@/logging_client.properties
handlers = java.util.logging.FileHandler
java.util.logging.FileHandler.pattern = @target.dir@/test_client.log
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
# If you want to provide finer grained logging, restrict the level for the
# specific package name.
# For example:
# org.apache.cactus.server.level = ALL
# org.apache.commons.httpclient.level = ALL
# .level = ALL
org.apache.cactus.level = ALL
# ---- Log4J logging properties
# Following properties are useful if you're using the Log4J logging subsystem
# and wish to output logs to a file. Make sure to comment out the NoOpLog line
# above.
log4j.configuration = file:/@target.dir@/logging_client.properties
log4j.appender.cactus = org.apache.log4j.FileAppender
log4j.appender.cactus.File = @target.dir@/test_client.log
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
# Debug logs for Cactus
log4j.category.org.apache.cactus = DEBUG, cactus
log4j.additivity.org.apache.cactus = false
# Debug logs for HttpClient
log4j.category.org.apache.commons.httpclient = DEBUG, cactus
log4j.additivity.org.apache.commons.httpclient = false
log4j.category.httpclient = WARN, cactus
log4j.additivity.httpclient = false
# ---- SimpleLog logging properties
org.apache.commons.logging.simplelog.showlogname = true
org.apache.commons.logging.simplelog.log.org.apache.cactus = trace
org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient = trace
1.1 jakarta-cactus/samples/servlet/logging_server.properties.sample
Index: logging_server.properties.sample
===================================================================
# -----------------------------------------------------------------------------
# Logging properties
# -----------------------------------------------------------------------------
# Disable logging by default when running the tests. If you wish to use a
# logging subsystem, uncomment the line below. That will let Commons logging
# decide automatically of a suitable logging system for you. You can also force
# commons-logging to use a specific logging system. For more info, see
# http://jakarta.apache.org/commons/logging/api/org/apache/commons/logging/package-summary.html#package_description
# Disable logging
#org.apache.commons.logging.Log = org.apache.commons.logging.impl.NoOpLog
# Force to use JDK 1.4 logging
#org.apache.commons.logging.Log = org.apache.commons.logging.impl.Jdk14Logger
# Force to use Log4J logging
#org.apache.commons.logging.Log = org.apache.commons.logging.impl.Log4JLogger
# Force to use Simple logging
#org.apache.commons.logging.Log = org.apache.commons.logging.impl.SimpleLog
# ---- JDK 1.4 logging properties
# Following properties are useful if you're using the JDK 1.4 logging subsystem
# and wish to output logs to a file. Make sure to comment out the NoOpLog line
# above.
java.util.logging.config.file = @target.dir@/logging_server.properties
handlers = java.util.logging.FileHandler
java.util.logging.FileHandler.pattern = @target.dir@/test_server.log
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
# If you want to provide finer grained logging, restrict the level for the
# specific package name.
# For example: org.apache.cactus.server.level = ALL
org.apache.cactus.level = ALL
# ---- Log4J logging properties
# Following properties are useful if you're using the Log4J logging subsystem
# and wish to output logs to a file. Make sure to comment out the NoOpLog line
# above.
log4j.configuration = file:/@target.dir@/logging_server.properties
log4j.appender.cactus = org.apache.log4j.FileAppender
log4j.appender.cactus.File = @target.dir@/test_server.log
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
# Debug logs for Cactus
log4j.category.org.apache.cactus = DEBUG, cactus
log4j.additivity.org.apache.cactus = false
# Debug logs for HttpClient
log4j.category.org.apache.commons.httpclient = DEBUG, cactus
log4j.additivity.org.apache.commons.httpclient = false
log4j.category.httpclient = WARN, cactus
log4j.additivity.httpclient = false
# ---- SimpleLog logging properties
org.apache.commons.logging.simplelog.showlogname = true
org.apache.commons.logging.simplelog.log.org.apache.cactus = trace
org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient = trace
---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org