ceki 2005/01/20 11:39:14
Modified: tests/integration/src/webapp/WEB-INF/classes
test-log4j.xml.sample
tests/integration build.xml
examples/tiny-webapp/Tata/WebRoot/WEB-INF/classes
tata-log4j.xml
examples/tiny-webapp INSTALL.txt
Added: tests/integration/src/webapp/WEB-INF/classes .cvsignore
Log:
Minor improvements and bug fixes in integration tests and in
examples/tiny-webapp.
Revision Changes Path
1.2 +5 -3
logging-log4j/tests/integration/src/webapp/WEB-INF/classes/test-log4j.xml.sample
Index: test-log4j.xml.sample
===================================================================
RCS file:
/home/cvs/logging-log4j/tests/integration/src/webapp/WEB-INF/classes/test-log4j.xml.sample,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- test-log4j.xml.sample 20 Jan 2005 19:15:50 -0000 1.1
+++ test-log4j.xml.sample 20 Jan 2005 19:39:14 -0000 1.2
@@ -8,10 +8,12 @@
</appender>
+ <!-- Please adapt the SMTPHost, From and To fields as appropriate
+ for your environment. -->
<appender name="EMAIL" class="org.apache.log4j.net.SMTPAppender">
- <param name="SMTPHost" value="mail.qos.ch"/>
- <param name="To" value="[EMAIL PROTECTED]"/>
- <param name="From" value="[EMAIL PROTECTED]"/>
+ <param name="SMTPHost" value="MAIL.SERVER.EMAIL-ADDRESS.COM"/>
+ <param name="To" value="[EMAIL PROTECTED]"/>
+ <param name="From" value="[EMAIL PROTECTED]"/>
<param name="BufferSize" value="128"/>
<param name="Subject" value="${os.name} - %m"/>
<param name="LocationInfo" value="true"/>
1.1
logging-log4j/tests/integration/src/webapp/WEB-INF/classes/.cvsignore
Index: .cvsignore
===================================================================
test-log4j.xml
1.4 +19 -3 logging-log4j/tests/integration/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/logging-log4j/tests/integration/build.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- build.xml 12 Jan 2005 18:04:41 -0000 1.3
+++ build.xml 20 Jan 2005 19:39:14 -0000 1.4
@@ -84,16 +84,32 @@
</jar>
</target>
+ <target name="clientConfigFileCheck">
+ <available file="${src.webapp.dir}/WEB-INF/classes/test-log4j.xml"
+ property="client-config-file-present"/>
+
+ <fail unless="client-config-file-present">
+ Could not find the file
+ ${src.webapp.dir}/WEB-INF/classes/test-log4j.xml
+ Have you forgotten to adapt and rename the test-log4j.xml.sample file?
+ </fail>
+ </target>
<!-- Create the war file -->
- <target name="war" depends="compile">
+ <target name="war" depends="compile, test-appender.jar,
clientConfigFileCheck">
+
<war warfile="${target.dir}/${project.name.file}.war"
webxml="${src.webapp.dir}/WEB-INF/web.xml">
- <fileset dir="${src.webapp.dir}"/>
- <classes dir="${target.classes.java.dir}"/>
+ <fileset dir="${src.webapp.dir}">
+ <exclude name="WEB-INF/classes/test-log4j.xml.sample"/>
+ </fileset>
+ <classes dir="${target.classes.java.dir}">
+ <exclude name="TestAppender.class"/>
+ </classes>
<lib file="${target.dir}/test-appender.jar"/>
<lib file="${javamail.jar}"/>
<lib file="${activation.jar}"/>
+ <lib file="${log4j.dir}/log4j-smtp.jar"/>
</war>
</target>
1.3 +1 -1
logging-log4j/examples/tiny-webapp/Tata/WebRoot/WEB-INF/classes/tata-log4j.xml
Index: tata-log4j.xml
===================================================================
RCS file:
/home/cvs/logging-log4j/examples/tiny-webapp/Tata/WebRoot/WEB-INF/classes/tata-log4j.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- tata-log4j.xml 20 Jan 2005 15:07:24 -0000 1.2
+++ tata-log4j.xml 20 Jan 2005 19:39:14 -0000 1.3
@@ -4,7 +4,7 @@
<configuration debug="true" xmlns='http://logging.apache.org/'>
<appender name="FILE" class="org.apache.log4j.FileAppender">
- <param name="File" value="/tata.log"/>
+ <param name="File" value="tata.log"/>
<param name="Append" value="false"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="TATA %r %-5p %c - %m%n"/>
1.8 +31 -7 logging-log4j/examples/tiny-webapp/INSTALL.txt
Index: INSTALL.txt
===================================================================
RCS file: /home/cvs/logging-log4j/examples/tiny-webapp/INSTALL.txt,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- INSTALL.txt 20 Jan 2005 17:55:36 -0000 1.7
+++ INSTALL.txt 20 Jan 2005 19:39:14 -0000 1.8
@@ -29,9 +29,31 @@
For Tomcat, you can add this line directly in ./bin/catalina.sh or
./bin/catalina.bat.
+ After you start Tomcat, the $TOMCAT_HOME/logs/catalina.out file
+ should contain a line with the following text.
+
+ *** Will use ContextJNDISelector **
+
+ If the above line exists, then you can be certain that setting the
+ log4j.repositorySelector system property had the desired affect.
+
- You can now run the supplied web-applications hello.war and
tata.war.
+ Alternatively, you can instruct Tomcat to run Hello and Tata
+ directly form LOG4J_HOME. Here is an excerpt from our 'server.xml'
+ file, that is Tomcat's configrationf file.
+
+ <Host name="localhost">
+ <Context
+ docBase="LOG4J_HOME/examples/tiny-webapp/Hello/WebRoot"
+ path="/hello"/>
+
+ <Context docBase="LOG4J_HOME/examples/tiny-webapp/Tata/WebRoot"
+ path="/tata"/>
+ </Host>
+
+
- Optionally, you can add a configuration file such as log4j.xml or
log4j.properties in the class directory of your *web-server*. For
Tomcat versions 4 or 5, that would be ./common/classes/ directory.
@@ -40,15 +62,17 @@
default logging repository using the configuration file found in
./common/classes/ directory.
- For Tomcat version 5 (tested on Tomcat 5.0.19), you also need to
- tell Tomcat to use log4j by placing commons-logging.jar in
- ./common/lib directory. You should also remove the
- commons-logging-api.jar from the ./bin/ directory.
+- Instructing Tomcat to use log4j
+
+ If you would like Tomcat to use log4j and its default repository,
+ you also need to tell Tomcat to use log4j by placing
+ commons-logging.jar in ./common/lib directory. You should also
+ remove the commons-logging-api.jar from the ./bin/ directory.
This way the default (log4j) logger repository will be used by
Tomcat for its logging and the default logger repository will be
controlled by the configuration file log4j.xml or log4j.properties
- found in ./common/classes/.
+ found in ./common/classes/. (Tested on Tomcat 5.0.19 and 5.0.27),
Steps performed per web-application
==================================
@@ -114,10 +138,10 @@
CAVEAT
======
-We recommend that you name configuration resources uniquely. In
+We recommend that you name log4j configuration resources uniquely. In
particualar, avoid naming the log4j configuration resource as
'log4j.xml' or as 'log4j.properties' for a non-default logger
-repository. For example, the following env-entry is error prone:
+repository. For example, the following env-entry is error-prone:
<env-entry>
<description>URL for configuring log4j context</description>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]