You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ce...@apache.org on 2002/10/10 00:50:09 UTC
cvs commit: jakarta-log4j/tests/witness PatternParser_mdc socketServer.5 socketServer.6 socketServer.7 socketServer.8 xmlLayout.3 xmlLayout.1 xmlLayout.2
ceki 2002/10/09 15:50:09
Modified: . INSTALL build.properties.sample build.xml
docs FAQ.html HISTORY manual.html
examples mycat.bad mycat.good
src/java/org/apache/log4j AppenderSkeleton.java
AsyncAppender.java Category.java
ConsoleAppender.java DailyRollingFileAppender.java
FileAppender.java HTMLLayout.java LogManager.java
MDC.java NDC.java PropertyConfigurator.java
Receiver.java SimpleLayout.java TTCCLayout.java
WriterAppender.java
src/java/org/apache/log4j/chainsaw EventDetails.java
src/java/org/apache/log4j/config PropertySetter.java
src/java/org/apache/log4j/helpers
AppenderAttachableImpl.java Loader.java
NullEnumeration.java OptionConverter.java
PatternParser.java SyslogWriter.java Transform.java
src/java/org/apache/log4j/jdbc JDBCAppender.java
src/java/org/apache/log4j/lf5 LF5Appender.java
src/java/org/apache/log4j/lf5/viewer LogBrokerMonitor.java
src/java/org/apache/log4j/lf5/viewer/configure
ConfigurationManager.java MRUFileManager.java
src/java/org/apache/log4j/net JMSAppender.java JMSSink.java
SimpleSocketServer.java SocketAppender.java
SocketNode.java SyslogAppender.java
src/java/org/apache/log4j/nt NTEventLogAppender.java
src/java/org/apache/log4j/or RendererMap.java
src/java/org/apache/log4j/performance NOPWriter.java
NewVsSetLen.java NullAppender.java logging
package.html
src/java/org/apache/log4j/performance/xml logging201.xml
logging202.xml logging203.xml logging204.xml
logging205.xml logging206.xml logging207.xml
src/java/org/apache/log4j/spi Configurator.java
LoggingEvent.java RepositorySelector.java
ThrowableInformation.java
src/java/org/apache/log4j/test AsyncAppenderTest.java
ConfigurationFileParsing.java
src/java/org/apache/log4j/varia FallbackErrorHandler.java
LevelMatchFilter.java LevelRangeFilter.java
src/java/org/apache/log4j/xml DOMConfigurator.java
XMLLayout.java log4j.dtd
src/xdocs contributors.xml documentation.xml download.xml
index.xml plan.xml
tests build.xml
tests/src/java/org/apache/log4j AsyncAppenderTestCase.java
VectorAppender.java
tests/src/java/org/apache/log4j/net ShortSocketServer.java
SocketServerTestCase.java
tests/src/java/org/apache/log4j/xml XMLLayoutTestCase.java
tests/witness xmlLayout.1 xmlLayout.2
Added: . BRANCHES
src/java/org/apache/log4j/performance/xml logging220.xml
logging221.xml logging222.xml logging223.xml
logging224.xml logging225.xml logging226.xml
logging227.xml
src/java/org/apache/log4j/varia NullAppender.java
src/xdocs/stylesheets lf5.xml
tests/input defaultInit3.properties socketServer5.properties
socketServer6.properties socketServer7.properties
socketServer8.properties
tests/input/xml defaultInit.xml fallback1.xml
tests/src/java/org/apache/log4j/helpers
PatternParserTestCase.java
tests/src/java/org/apache/log4j/varia
ErrorHandlerTestCase.java
tests/witness PatternParser_mdc socketServer.5
socketServer.6 socketServer.7 socketServer.8
xmlLayout.3
Removed: build siteBuild.sh siteBuild.xml
src/java/org/apache/log4j/lf5/util ProductProperties.java
src/java/org/apache/log4j/lf5/viewer
LogFactor5AboutDialog.java
src/java/org/apache/log4j/lf5/viewer/images lf5_about.gif
lf5_small_icon.png
Log:
The commit of 1.2branch with the trunk. Things seem to have went
relatively well. Conflicts were quickly resolved. The resulting code
builds and passes all existing tests.
Revision Changes Path
1.20 +3 -2 jakarta-log4j/INSTALL
Index: INSTALL
===================================================================
RCS file: /home/cvs/jakarta-log4j/INSTALL,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- INSTALL 10 May 2002 08:00:54 -0000 1.19
+++ INSTALL 9 Oct 2002 22:50:01 -0000 1.20
@@ -48,7 +48,7 @@
=========
The log4j distribution comes with one jar file: log4j-VERSION.jar
-under the $LOG4J_HOME/dist/lib/ directory.
+under the LOG4J_HOME/dist/lib/ directory.
This jar file contains all the class files of the log4j project,
except test cases and classes from the "examples" and
@@ -82,7 +82,8 @@
The SMTPAppender relies on the JavaMail API. It has been tested with
JavaMail API version 1.2. The JavaMail API requires the
- JavaBeans Activation Framework package. You can download the JavaMail API at:
+ JavaBeans Activation Framework package. You can download the
+ JavaMail API at:
http://java.sun.com/products/javamail/
1.4 +6 -0 jakarta-log4j/build.properties.sample
Index: build.properties.sample
===================================================================
RCS file: /home/cvs/jakarta-log4j/build.properties.sample,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- build.properties.sample 25 May 2002 12:24:03 -0000 1.3
+++ build.properties.sample 9 Oct 2002 22:50:01 -0000 1.4
@@ -18,6 +18,12 @@
jmx.jar=/java/jmx/lib/jmxri.jar
jmx-extra.jar=/java/jmx/lib/jmxtools.jar
+# jakarta-site2 module is used to transform xml files to html using
+# Anakia. You do not need to worry about this property unless you
+# intend to build the log4j web site yourself.
+jakarta-site2=../jakarta-site2
+
# Required to run Checkstyle. Available from http://checkstyle.sf.net
checkstyle.jar=/java/checkstyle-2.2/checkstyle-all-2.2.jar
+
1.37 +79 -9 jakarta-log4j/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-log4j/build.xml,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- build.xml 11 Jun 2002 07:05:41 -0000 1.36
+++ build.xml 9 Oct 2002 22:50:01 -0000 1.37
@@ -17,7 +17,7 @@
<!-- prefixed with "env". -->
<property environment="env"/>
- <property name="version" value="1.2"/>
+ <property name="version" value="1.2.7"/>
<!-- The base directory relative to which most targets are built -->
<property name="base" value="."/>
@@ -35,11 +35,14 @@
<!-- Destination for generated jar files -->
<property name="jar.dest" value="dist/lib"/>
+ <!-- The jar file that the jar task will generate -->
<property name="jar.filename" value="log4j-${version}.jar"/>
+ <!-- Destination for documentation files -->
+ <property name="docs.dest" value="./docs"/>
+ <!-- Source directory for xml docs -->
+ <property name="xdocs.src" value="./src/xdocs"/>
- <!-- Destination for documentation files generated or not -->
- <property name="docs" value="docs"/>
<!-- Destination for javadoc generated files -->
<property name="javadoc.dest" value="docs/api"/>
@@ -75,6 +78,13 @@
<pathelement location="${jmx-extra.jar}"/>
</path>
+ <!-- Construct compile classpath -->
+ <path id="site2.classpath">
+ <fileset dir="${jakarta-site2}/lib">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+
<!-- ================================================================= -->
<!-- Default target -->
@@ -179,6 +189,12 @@
<classpath refid="compile.classpath"/>
</javac>
+ <copy todir="${javac.dest}">
+ <fileset dir="${java.source.dir}"
+ includes="${stem}/lf5/**/*.properties"/>
+ <fileset dir="${java.source.dir}"
+ includes="${stem}/lf5/viewer/images/*"/>
+ </copy>
</target>
<target name="build.examples" depends="build.core">
@@ -193,6 +209,12 @@
<rmic base="${javac.dest}"
classname="examples.NumberCruncherServer"
/>
+
+ <copy todir="${javac.dest}">
+ <fileset dir="." includes="examples/lf5/**/*.properties"/>
+ <fileset dir="." includes="examples/lf5/**/*.xml"/>
+ </copy>
+
</target>
<target name="build.xml" depends="init, jaxp" if="jaxp-present">
@@ -309,6 +331,9 @@
${stem}/jdbc/*.class,
${stem}/varia/*.class,
${stem}/chainsaw/*.class,
+ ${stem}/lf5/**/*.class,
+ ${stem}/lf5/**/*.properties,
+ ${stem}/lf5/**/*.gif,
${stem}/nt/*.class,
${stem}/xml/*.class,
${stem}/jmx/*.class,
@@ -336,6 +361,7 @@
org.apache.log4j.filters,
org.apache.log4j.helpers,
org.apache.log4j.jmx,
+ org.apache.log4j.lf5,
org.apache.log4j.net,
org.apache.log4j.nt,
org.apache.log4j.or,
@@ -352,23 +378,66 @@
protected="true"
author="true"
use="true"
- overview="${docs}/overview.html"
+ overview="${docs.dest}/overview.html"
doctitle="log4j version ${version}<br>API Specification"
windowtitle="Log4j Version ${version}"
header="<b>Log4j ${version}</b>"
bottom="Copyright 2000-2002 Apache Software Foundation.">
- <link offline="true"
- href="http://java.sun.com/products/jdk/1.2/docs/api"
- packageListLoc="${packaging.dir}"/>
+ <link href="http://java.sun.com/products/jdk/1.3/docs/api"/>
+ <link href="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/"/>
<classpath refid="compile.classpath"/>
</javadoc>
</target>
+ <!-- ============================================== -->
+ <!-- Build the site files using Anakia -->
+ <!-- ============================================== -->
+ <target name="prepareSite2">
+ <available classname="org.apache.velocity.anakia.AnakiaTask"
+ property="AnakiaTask.present">
+ <classpath refid="site2.classpath"/>
+ </available>
+ </target>
+
+ <target name="checkSite2" depends="prepareSite2" unless="AnakiaTask.present">
+ <echo>
+ AnakiaTask is not present! Please check to make sure that
+ velocity.jar is in your classpath.
+ </echo>
+ </target>
+
+ <target name="site2" depends="checkSite2" if="AnakiaTask.present">
+ <taskdef name="anakia" classname="org.apache.velocity.anakia.AnakiaTask">
+ <classpath refid="site2.classpath"/>
+ </taskdef>
+
+ <anakia basedir="${xdocs.src}" destdir="${docs.dest}/"
+ extension=".html"
+ style="site.vsl"
+ projectFile="stylesheets/project.xml"
+ excludes="**/stylesheets/**, empty.xml, lf5/**"
+ includes="**/*.xml"
+ lastModifiedCheck="true"
+ templatePath="../jakarta-site2/xdocs/stylesheets">
+ </anakia>
+
+ <anakia basedir="${xdocs.src}" destdir="${docs.dest}/"
+ extension=".html"
+ style="site.vsl"
+ projectFile="stylesheets/lf5.xml"
+ excludes="**/stylesheets/**, empty.xml"
+ includes="lf5/*.xml"
+ lastModifiedCheck="true"
+ templatePath="../jakarta-site2/xdocs/stylesheets">
+ </anakia>
+ </target>
+
+
<!-- ================================================================= -->
<!-- Build a complete distribution. Results go to ${dist.images} -->
<!-- ================================================================= -->
- <target name="dist" depends="init, clean, javadoc, jar">
+ <target name="dist" depends="init, clean, javadoc, jar, site2">
<delete verbose="true">
<fileset dir=".">
@@ -405,7 +474,7 @@
</delete>
<mkdir dir="${dist.images}" />
-
+
<mkdir dir="${dist.tmp}/jakarta-log4j-${version}" />
<copy todir="${dist.tmp}/jakarta-log4j-${version}">
@@ -415,6 +484,7 @@
examples/**,
build/*,
build.xml,
+ build.properties.sample,
manifest.mf,
INSTALL,
LICENSE.txt,
1.2 +61 -0 jakarta-log4j/BRANCHES
1.16 +11 -12 jakarta-log4j/docs/FAQ.html
Index: FAQ.html
===================================================================
RCS file: /home/cvs/jakarta-log4j/docs/FAQ.html,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- FAQ.html 7 May 2002 23:39:33 -0000 1.15
+++ FAQ.html 9 Oct 2002 22:50:01 -0000 1.16
@@ -60,8 +60,8 @@
(possibly across multiple timezones) logging to the same file using the
method above, what happens to timestamps?</P>
-<LI><P><A HREF="#j2ee">Why can't Log4J find my properties file in a J2EE or WAR application?</P>
-<LI><P><A HREF="#configureandwatch">Is there a way to get Log4J to automatically reload a configuration file if it changes?</P>
+<LI><P><A HREF="#j2ee">Why can't log4j find my properties file in a J2EE or WAR application?</P>
+<LI><P><A HREF="#configureandwatch">Is there a way to get log4j to automatically reload a configuration file if it changes?</P>
<LI><P><A HREF="#nteventlogproblems">What does the Windows NT Event Viewer complain about missing descriptions for my event messages
when I use the NTEventLogAppender?</P>
<LI><P><A HREF="#morenteventlogproblems">Why can't I map my logger names to the loggers that appear in the
@@ -436,9 +436,8 @@
<p>This policy usually best encapsulates what the user actually wants
to do, as opposed to her mind-projected solution.
-<p>See <a
-href="api/org/apache/log4j/examples/doc-files/sort4.lcf">sort4.lcf</a>
-for an example threshold configuration.
+<p>See <i>examples/sort4.lcf</i> for an example threshold
+configuration.
<p>If you must filter events by exact level match, then you can
attach a <a
@@ -477,10 +476,10 @@
seen in the log file would all appear in order, generated at the time they
arrived at the log server host according to its local clock.
-<p><a name=j2ee><h4>Why can't Log4J find my properties file in a J2EE
+<p><a name=j2ee><h4>Why can't log4j find my properties file in a J2EE
or WAR application?</h4>
-The short answer: the Log4J classes and the properties file are not
+The short answer: the log4j classes and the properties file are not
within the scope of the same classloader.<P>
The long answer (and what to do about it): J2EE or Servlet containers
@@ -490,14 +489,14 @@
classloader needs to find a class or a resource, it first delegates
the request to the parent.
-<P>Log4J only uses the default <CODE>Class.forName()</code> mechanism
+<P>Log4j only uses the default <CODE>Class.forName()</code> mechanism
for loading classes. Resources are handled similarly. See the
documentation for <CODE>java.lang.ClassLoader</CODE> for more details.
<P>So, if you're having problems, try loading the class or resource
-yourself. If you can't find it, neither will Log4J. ;)
+yourself. If you can't find it, neither will log4j. ;)
-<P><A NAME=configureandwatch><H4>Is there a way to get Log4J to
+<P><A NAME=configureandwatch><H4>Is there a way to get log4j to
automatically reload a configuration file if it changes?</H4>
<P>Yes. Both the DOMConfigurator and the PropertyConfigurator support
@@ -593,8 +592,8 @@
<p><li>Take responsibility for your code.
- <p>Authoring software is like parenting. It takes many
- years to raise a child.
+ <p>Authoring software is very much like running a marathon. It
+ takes time and endurance.
<p><li>Did I mention sticking with the indentation style?
1.98 +110 -0 jakarta-log4j/docs/HISTORY
Index: HISTORY
===================================================================
RCS file: /home/cvs/jakarta-log4j/docs/HISTORY,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -r1.97 -r1.98
--- HISTORY 10 May 2002 08:00:54 -0000 1.97
+++ HISTORY 9 Oct 2002 22:50:01 -0000 1.98
@@ -5,6 +5,116 @@
client code.
[***] Changes requiring important modifications to existing client code.
+
+ October 9th, 2002
+
+ - Release of version 1.2.7
+
+ - Log4j now searches for the file log4j.xml as well as the file
+ log4j.properties during log4j initialization. [*]
+
+ July 31st, 2002
+
+ - Release of version 1.2.6
+
+ - Addition of new options in JMSAppender and new command line arguments in
+ JMSSink. [*]
+
+ - Added new method getLoggerName() in LoggingEvent class. The
+ getLoggerName is the preferred way for accessing the logger
+ name. The public access categoryName field should not be accessed
+ directly. Similarly, added the getLevel method which is now the
+ preferred way of accessing the event's level. The public access
+ level field should not be accessed directly. The javadocs now mark
+ the categoryName and level fields as deprecated.
+
+ Modified existing appenders to comply with these new directives. [*]
+
+ - Log4j now will check if a system property named "log4j.ignoreTCL"
+ is set. If it is set, then it will ignore the Thread Context
+ ClassLoader when loading classes. This solves the irritating
+ "appender is not assignable to Appender" messages observed when
+ log4j.jar is loaded by multiple class loaders.
+
+ The error reporting for this problem was also improved. [*]
+
+ - Fixed bug #10528 whereby calling the MDC.get method with a null
+ argument would throw a NullPointerException. [*]
+
+ July 5th, 2002
+
+ - Release of version 1.2.5
+
+ - Minor changes and bug fixes in LF5. [*]
+
+ - Calling an AsyncAppender close method also closes the embedded
+ appender instances. This resolves bug #10185 submitted by Paul
+ Voutier. [*]
+
+ June 12th, 2002
+
+ - Release of version 1.2.4
+
+ - The JDBCAppender is marked as slated for replacement. Do not build
+ critical software using it.
+
+ - Added LF5 documentation and examples. Further tests are required
+ for full integration. [*]
+
+ - XMLLayout can now output messages which contain embedded CDATA
+ sections. This resolves bug #9750. Many thanks to Michael
+ A. McAngus for supplying the relevant patch. [*]
+
+ - The dispatcher thread associated with AsyncAppender is now marked
+ as a deamon thread. This resolves bug #9750. [*]
+
+ - Added missing NTEventLogAppender.dll as reported in bug #9606. [*]
+
+ - In response to bug report 9435, the log4j.dtd was changed so that
+ <log4j:event> is now made of logger and level attributes instead of
+ category and priority. Changed XMLLayout to conform to the
+ DTD. Chainsaw was changed to adapt to the XMLLayout. [*]
+
+ - Added missing LevelRangeFilter file. [*]
+
+ May 24th, 2002
+
+ - Release of version 1.2.3
+
+ - Fixed bug #9285 where the SyslogAppender would incorrectly compute
+ the length of the datagram to send to the remote syslogd host.
+ Reported by Mamoru Kadota. [*]
+
+ - Fixed bug #8505 where the stack trace of exception would not be
+ properly printed on the Compaq tru64 Unix platform. Initially
+ reported by Fabrice Claes and later by Espen H. Kolstad who also
+ provided the fix. [*]
+
+ May 22nd, 2002
+
+ - Release of version 1.2.2
+
+ - Log4j configurators take the "NULL" string value as a synonym for
+ "INHERITED". Both of these two strings are legal level values for
+ setting the level of a logger. Both values are case insensitive. [*]
+
+ - When loading component classes, log4j will now first attempt to use
+ the Thread Context Loader and if that fails, it will use
+ Class.forName. In log4j 1.2 and 1.2.1, only Class.forName was used
+ and the TCL was ignored. This change is a response to bug #9305
+ opened by Scott M. Stark. [*]
+
+ May 17th, 2002
+
+ - Release of version 1.2.1
+
+ - This minor release fixes bug #9155 reported by Nicko Cadell.
+ LoggingEvent.getMDCCopy() method now sets mdcCopyLookupRequired
+ instead of ndcLookupRequired. This bug would cause the wrong MDC
+ information to appear on a log server. It could only occur if the
+ client wrapped an AsyncAppender around a SocketAppender or if the
+ server used an AsyncAppender for its logging. [*]
+
May, 2002
- Release of version 1.2
1.35 +3 -3 jakarta-log4j/docs/manual.html
Index: manual.html
===================================================================
RCS file: /home/cvs/jakarta-log4j/docs/manual.html,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- manual.html 14 May 2002 20:44:08 -0000 1.34
+++ manual.html 9 Oct 2002 22:50:01 -0000 1.35
@@ -814,9 +814,9 @@
<ol>
- <li>Skip default initialization if the system property
- <b>log4j.defaultInitOverride</b> is set to any value other than
- "false".
+ <li>Setting the <b>log4j.defaultInitOverride</b> system property to
+ any other value then "false" will cause log4j to skip the default
+ initialization procedure (this procedure).
<p><li>Set the <code>resource</code> string variable to the value of
the <b>log4j.configuration</b> system property. <em>The preferred
1.6 +8 -6 jakarta-log4j/examples/mycat.bad
Index: mycat.bad
===================================================================
RCS file: /home/cvs/jakarta-log4j/examples/mycat.bad,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- mycat.bad 20 May 2001 15:03:07 -0000 1.5
+++ mycat.bad 9 Oct 2002 22:50:01 -0000 1.6
@@ -1,16 +1,18 @@
# The usual stuff. Note that A1 is configured in root not in "some.cat"
-log4j.rootCategory=DEBUG, A1
+log4j.rootLogger=DEBUG, A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%5p [%t] %c - %m%n
# Set the priority of "some.cat" to TRACE (defined in
-# org.apache.log4j.xml.examples.XPriority). This will actually have
-# the side effect of instanciating a category object having the name
-# "some.cat" this will cause a ClassCastException if the category
-# object is cast as a MyCategory object.
+# examples.customLevel.XLevel). This will actually have the side
+# effect of instanciating a logger object having the name "some.cat"
+# this will cause a ClassCastException if the logger object is cast
+# as a MyLogger object.
+
+log4j.logger.some.cat=TRACE#examples.customLevel.XLevel
+
-log4j.category.some.cat=TRACE#org.apache.log4j.xml.examples.XPriority
1.7 +8 -8 jakarta-log4j/examples/mycat.good
Index: mycat.good
===================================================================
RCS file: /home/cvs/jakarta-log4j/examples/mycat.good,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- mycat.good 20 May 2001 15:03:07 -0000 1.6
+++ mycat.good 9 Oct 2002 22:50:01 -0000 1.7
@@ -1,13 +1,13 @@
-# Setting the category factory to MyCategoryFactory solves the
+# Setting the logger factory to MyLoggerFactory solves the
# ClassCastException problem encountered with the "mycat.bad"
# configuration file.
-log4j.categoryFactory=org.apache.log4j.examples.MyCategoryFactory
+log4j.loggerFactory=examples.subclass.MyLoggerFactory
# The usual stuff. Note that A1 is configured in root not in "some.cat"
-log4j.rootCategory=DEBUG, A1
+log4j.rootLogger=DEBUG, A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
@@ -15,10 +15,10 @@
# Set the priority of "some.cat" to TRACE (defined in
-# org.apache.log4j.xml.examples.XPriority). Since we specified
-# MyCategoryFactory as the category factory, the following line willl
-# also have the side effect of instanciating a MyCategory object
-# having the name "some.cat".
+# examples.customLevel.XLevel). Since we specified MyLoggerFactory as
+# the logger factory, the following line willl also have the side
+# effect of instanciating a MyLogger object having the name
+# "some.cat".
-log4j.category.some.cat=TRACE#org.apache.log4j.xml.examples.XPriority
+log4j.logger.some.cat=TRACE#examples.customLevel.XLevel
1.20 +15 -16 jakarta-log4j/src/java/org/apache/log4j/AppenderSkeleton.java
Index: AppenderSkeleton.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/AppenderSkeleton.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- AppenderSkeleton.java 9 May 2002 17:44:54 -0000 1.19
+++ AppenderSkeleton.java 9 Oct 2002 22:50:01 -0000 1.20
@@ -17,13 +17,14 @@
/**
- Abstract superclass of the other appenders in the package.
-
- This class provides the code for common functionality, such as
- support for threshold filtering and support for general filters.
-
- @since 0.8.1
- @author Ceki Gülcü */
+ * Abstract superclass of the other appenders in the package.
+ *
+ * This class provides the code for common functionality, such as
+ * support for threshold filtering and support for general filters.
+ *
+ * @since 0.8.1
+ * @author Ceki Gülcü
+ * */
public abstract class AppenderSkeleton implements Appender, OptionHandler {
/** The layout variable does not need to be set if the appender
@@ -99,11 +100,10 @@
}
/**
- Finalize this appender by calling the imlenentation's
+ Finalize this appender by calling the derived class'
<code>close</code> method.
- @since 0.8.4
- */
+ @since 0.8.4 */
public
void finalize() {
// An appender might be closed then garbage collected. There is no
@@ -191,11 +191,10 @@
/**
- This method performs threshold checks and invokes filters before
- delegating actual logging to the subclasses specific {@link
- AppenderSkeleton#append} method.
-
- */
+ * This method performs threshold checks and invokes filters before
+ * delegating actual logging to the subclasses specific {@link
+ * AppenderSkeleton#append} method.
+ * */
public
synchronized
void doAppend(LoggingEvent event) {
@@ -204,7 +203,7 @@
return;
}
- if(!isAsSevereAsThreshold(event.level)) {
+ if(!isAsSevereAsThreshold(event.getLevel())) {
return;
}
1.31 +48 -61 jakarta-log4j/src/java/org/apache/log4j/AsyncAppender.java
Index: AsyncAppender.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/AsyncAppender.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- AsyncAppender.java 9 May 2002 17:44:54 -0000 1.30
+++ AsyncAppender.java 9 Oct 2002 22:50:01 -0000 1.31
@@ -33,11 +33,7 @@
<p><b>Important note:</b> The <code>AsyncAppender</code> can only
be script configured using the {@link
- org.apache.log4j.xml.DOMConfigurator}. Refer to example configuration
- files <a href="xml/examples/doc-files/sample4.xml">sample4.xml</a>
- and <a href="xml/examples/doc-files/sample5.xml">sample5.xml</a>.
-
-
+ org.apache.log4j.xml.DOMConfigurator}.
@author Ceki Gülcü
@since 0.9.1 */
@@ -57,8 +53,7 @@
boolean interruptedWarningMessage = false;
- public
- AsyncAppender() {
+ public AsyncAppender() {
// Note: The dispatcher code assumes that the aai is set once and
// for all.
aai = new AppenderAttachableImpl();
@@ -67,15 +62,13 @@
}
- public
- void addAppender(Appender newAppender) {
+ public void addAppender(Appender newAppender) {
synchronized(aai) {
aai.addAppender(newAppender);
}
}
- public
- void append(LoggingEvent event) {
+ public void append(LoggingEvent event) {
// Set the NDC and thread name for the calling thread as these
// LoggingEvent fields were not set at event creation time.
event.getNDC();
@@ -114,8 +107,7 @@
dispatcher thread which will process all pending events before
exiting.
*/
- public
- void close() {
+ public void close() {
synchronized(this) {
// avoid multiple close, otherwise one gets NullPointerException
if(closed) {
@@ -139,15 +131,13 @@
bf = null;
}
- public
- Enumeration getAllAppenders() {
+ public Enumeration getAllAppenders() {
synchronized(aai) {
return aai.getAllAppenders();
}
}
- public
- Appender getAppender(String name) {
+ public Appender getAppender(String name) {
synchronized(aai) {
return aai.getAppender(name);
}
@@ -156,89 +146,80 @@
/**
Returns the current value of the <b>LocationInfo</b> option.
*/
- public
- boolean getLocationInfo() {
+ public boolean getLocationInfo() {
return locationInfo;
}
/**
Is the appender passed as parameter attached to this category?
*/
- public
- boolean isAttached(Appender appender) {
+ public boolean isAttached(Appender appender) {
return aai.isAttached(appender);
}
/**
The <code>AsyncAppender</code> does not require a layout. Hence,
- this method always returns <code>false</code>. */
- public
- boolean requiresLayout() {
+ this method always returns <code>false</code>.
+ */
+ public boolean requiresLayout() {
return false;
}
- public
- void removeAllAppenders() {
+ public void removeAllAppenders() {
synchronized(aai) {
aai.removeAllAppenders();
}
}
- public
- void removeAppender(Appender appender) {
+ public void removeAppender(Appender appender) {
synchronized(aai) {
aai.removeAppender(appender);
}
}
- public
- void removeAppender(String name) {
+ public void removeAppender(String name) {
synchronized(aai) {
aai.removeAppender(name);
}
}
/**
- The <b>LocationInfo</b> option takes a boolean value. By
- default, it is set to false which means there will be no effort
- to extract the location information related to the event. As a
- result, the event that will be ultimately logged will likely to
- contain the wrong location information (if present in the log
- format).
-
- <p>Location information extraction is comparatively very slow and
- should be avoided unless performance is not a concern.
- */
- public
- void setLocationInfo(boolean flag) {
+ * The <b>LocationInfo</b> option takes a boolean value. By default,
+ * it is set to false which means there will be no effort to extract
+ * the location information related to the event. As a result, the
+ * event that will be ultimately logged will likely to contain the
+ * wrong location information (if present in the log format).
+ *
+ * <p>Location information extraction is comparatively very slow and
+ * should be avoided unless performance is not a concern.
+ * */
+ public void setLocationInfo(boolean flag) {
locationInfo = flag;
}
/**
- The <b>BufferSize</b> option takes a non-negative integer
- value. This integer value determines the maximum size of the
- bounded buffer. Increasing the size of the buffer is always
- safe. However, if an existing buffer holds unwritten elements,
- then <em>decreasing the buffer size will result in event
- loss.</em> Nevertheless, while script configuring the
- AsyncAppender, it is safe to set a buffer size smaller than the
- {@link #DEFAULT_BUFFER_SIZE default buffer size} because
- configurators guarantee that an appender cannot be used before
- being completely configured.
- */
- public
- void setBufferSize(int size) {
+ * The <b>BufferSize</b> option takes a non-negative integer value.
+ * This integer value determines the maximum size of the bounded
+ * buffer. Increasing the size of the buffer is always
+ * safe. However, if an existing buffer holds unwritten elements,
+ * then <em>decreasing the buffer size will result in event
+ * loss.</em> Nevertheless, while script configuring the
+ * AsyncAppender, it is safe to set a buffer size smaller than the
+ * {@link #DEFAULT_BUFFER_SIZE default buffer size} because
+ * configurators guarantee that an appender cannot be used before
+ * being completely configured.
+ * */
+ public void setBufferSize(int size) {
bf.resize(size);
}
/**
Returns the current value of the <b>BufferSize</b> option.
*/
- public
- int getBufferSize() {
+ public int getBufferSize() {
return bf.getMaxSize();
}
@@ -256,10 +237,14 @@
Dispatcher(BoundedFIFO bf, AsyncAppender container) {
this.bf = bf;
this.container = container;
- this.aai = container.aai;
+ this.aai = container.aai;
+ // It is the user's responsibility to close appenders before
+ // exiting.
+ this.setDaemon(true);
// set the dispatcher priority to lowest possible value
this.setPriority(Thread.MIN_PRIORITY);
this.setName("Dispatcher-"+getName());
+
// set the dispatcher priority to MIN_PRIORITY plus or minus 2
// depending on the direction of MIN to MAX_PRIORITY.
//+ (Thread.MAX_PRIORITY > Thread.MIN_PRIORITY ? 1 : -1)*2);
@@ -289,8 +274,7 @@
<p>Other approaches might yield better results.
*/
- public
- void run() {
+ public void run() {
//Category cat = Category.getInstance(Dispatcher.class.getName());
@@ -302,7 +286,7 @@
// Exit loop if interrupted but only if the the buffer is empty.
if(interrupted) {
//cat.info("Exiting.");
- return;
+ break;
}
try {
//LogLog.debug("Waiting for new event to dispatch.");
@@ -327,5 +311,8 @@
}
}
} // while
+
+ // close and remove all appenders
+ aai.removeAllAppenders();
}
}
1.69 +4 -8 jakarta-log4j/src/java/org/apache/log4j/Category.java
Index: Category.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/Category.java,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- Category.java 9 May 2002 20:15:01 -0000 1.68
+++ Category.java 9 Oct 2002 22:50:01 -0000 1.69
@@ -77,9 +77,6 @@
//final Hierarchy defaultHierarchy = new Hierarchy(new
// RootCategory(Level.DEBUG));
-
- static int nooptimize;
-
/**
The name of this category.
*/
@@ -431,9 +428,10 @@
}
/**
-
- @deprecated Has been replaced by the {@link #getEffectiveLevel}
- method. */
+ *
+ * @deprecated Please use the the {@link #getEffectiveLevel} method
+ * instead.
+ * */
public
Priority getChainedPriority() {
for(Category c = this; c != null; c=c.parent) {
@@ -513,7 +511,6 @@
public
static
Category getInstance(String name) {
- nooptimize++;
return LogManager.getLogger(name);
}
@@ -530,7 +527,6 @@
public
static
Category getInstance(Class clazz) {
- nooptimize++;
return LogManager.getLogger(clazz);
}
1.13 +20 -18 jakarta-log4j/src/java/org/apache/log4j/ConsoleAppender.java
Index: ConsoleAppender.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/ConsoleAppender.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ConsoleAppender.java 24 Apr 2002 01:16:14 -0000 1.12
+++ ConsoleAppender.java 9 Oct 2002 22:50:01 -0000 1.13
@@ -11,12 +11,12 @@
import org.apache.log4j.helpers.LogLog;
/**
- ConsoleAppender appends log events to <code>System.out</code> or
- <code>System.err</code> using a layout specified by the
- user. The default target is <code>System.out</code>.
-
- @author Ceki Gülcü
- @since 1.1 */
+ * ConsoleAppender appends log events to <code>System.out</code> or
+ * <code>System.err</code> using a layout specified by the user. The
+ * default target is <code>System.out</code>.
+ *
+ * @author Ceki Gülcü
+ * @since 1.1 */
public class ConsoleAppender extends WriterAppender {
public static final String SYSTEM_OUT = "System.out";
@@ -47,9 +47,10 @@
}
/**
- Sets the value of the <b>Target</b> option. Recognized values are
- "System.out" and "System.err". Any other value will be ignored.
- */
+ * Sets the value of the <b>Target</b> option. Recognized values
+ * are "System.out" and "System.err". Any other value will be
+ * ignored.
+ * */
public
void setTarget(String value) {
String v = value.trim();
@@ -64,12 +65,11 @@
}
/**
- Returns the current value of the <b>Target</b> property. The default
- value of the option is "System.out".
-
- See also {@link #setTarget}.
-
- */
+ * Returns the current value of the <b>Target</b> property. The
+ * default value of the option is "System.out".
+ *
+ * See also {@link #setTarget}.
+ * */
public
String getTarget() {
return target;
@@ -77,7 +77,7 @@
void targetWarn(String val) {
LogLog.warn("["+val+"] should be System.out or System.err.");
- LogLog.warn("Using System.out (default).");
+ LogLog.warn("Using previously set target, System.out by default.");
}
public
@@ -90,8 +90,10 @@
}
/**
- Override the parent method to do nothing.
- */
+ * This method overrides the parent {@link
+ * WriterAppender#closeWriter} implementation to do nothing because
+ * the console stream is not ours to close.
+ * */
protected
final
void closeWriter() {
1.21 +55 -57 jakarta-log4j/src/java/org/apache/log4j/DailyRollingFileAppender.java
Index: DailyRollingFileAppender.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/DailyRollingFileAppender.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- DailyRollingFileAppender.java 9 May 2002 10:25:18 -0000 1.20
+++ DailyRollingFileAppender.java 9 Oct 2002 22:50:02 -0000 1.21
@@ -52,11 +52,10 @@
<td><code>'.'yyyy-MM</code>
<td>Rollover at the beginning of each month</td>
- <td>Assuming the first day of the week is Sunday, at Sunday 00:00,
- March 25th, 2001, <code>/foo/bar.log</code> will be copied to
- <code>/foo/bar.log.2001-03</code>. Logging for the month of April
- will be output to <code>/foo/bar.log</code> until it rolls over
- at the beginning of May.
+ <td>At midnight of May 31st, 2002 <code>/foo/bar.log</code> will be
+ copied to <code>/foo/bar.log.2002-05</code>. Logging for the month
+ of June will be output to <code>/foo/bar.log</code> until it is
+ also rolled over the next month.
<tr>
<td><code>'.'yyyy-ww</code>
@@ -64,18 +63,19 @@
<td>Rollover at the first day of each week. The first day of the
week depends on the locale.</td>
- <td>At midnight, on March 31st, 2001, <code>/foo/bar.log</code>
- will be copied to <code>/foo/bar.log.2001-08</code>. Logging for
- the 9th week of 2001 will be output to <code>/foo/bar.log</code>
- until it is rolled over the next week.
+ <td>Assuming the first day of the week is Sunday, on Saturday
+ midnight, June 9th 2002, the file <i>/foo/bar.log</i> will be
+ copied to <i>/foo/bar.log.2002-23</i>. Logging for the 24th week
+ of 2002 will be output to <code>/foo/bar.log</code> until it is
+ rolled over the next week.
<tr>
<td><code>'.'yyyy-MM-dd</code>
<td>Rollover at midnight each day.</td>
- <td>At midnight, on March 9th, 2001, <code>/foo/bar.log</code> will
- be copied to <code>/foo/bar.log.2001-03-08</code>. Logging for the
+ <td>At midnight, on March 8th, 2002, <code>/foo/bar.log</code> will
+ be copied to <code>/foo/bar.log.2002-03-08</code>. Logging for the
9th day of March will be output to <code>/foo/bar.log</code> until
it is rolled over the next day.
@@ -84,19 +84,19 @@
<td>Rollover at midnight and midday of each day.</td>
- <td>At noon, on March 9th, 2001, <code>/foo/bar.log</code> will be
- copied to <code>/foo/bar.log.2001-03-09-AM</code>. Logging for the
+ <td>At noon, on March 9th, 2002, <code>/foo/bar.log</code> will be
+ copied to <code>/foo/bar.log.2002-03-09-AM</code>. Logging for the
afternoon of the 9th will be output to <code>/foo/bar.log</code>
- until it is rolled over the next morning, i.e at midnight 00:00.
+ until it is rolled over at midnight.
<tr>
<td><code>'.'yyyy-MM-dd-HH</code>
<td>Rollover at the top of every hour.</td>
- <td>At approximately 11:00,000, on March 9th, 2001,
+ <td>At approximately 11:00.000 o'clock on March 9th, 2002,
<code>/foo/bar.log</code> will be copied to
- <code>/foo/bar.log.2001-03-09-10</code>. Logging for the 11th hour
+ <code>/foo/bar.log.2002-03-09-10</code>. Logging for the 11th hour
of the 9th of March will be output to <code>/foo/bar.log</code>
until it is rolled over at the beginning of the next hour.
@@ -143,13 +143,19 @@
private String datePattern = "'.'yyyy-MM-dd";
/**
- The actual formatted filename that is currently being written to.
+ The log file will be renamed to the value of the
+ scheduledFilename variable when the next interval is entered. For
+ example, if the rollover period is one hour, the log file will be
+ renamed to the value of "scheduledFilename" at the beginning of
+ the next hour.
+
+ The precise time when a rollover occurs depends on logging
+ activity.
*/
private String scheduledFilename;
/**
- The timestamp when we shall next recompute the filename.
- */
+ The next time we estimate a rollover should occur. */
private long nextCheck = System.currentTimeMillis () - 1;
Date now = new Date();
@@ -160,14 +166,13 @@
int checkPeriod = TOP_OF_TROUBLE;
-
+ // The gmtTimeZone is used only in computeCheckPeriod() method.
static final TimeZone gmtTimeZone = TimeZone.getTimeZone("GMT");
/**
The default constructor does nothing. */
- public
- DailyRollingFileAppender() {
+ public DailyRollingFileAppender() {
}
/**
@@ -188,19 +193,16 @@
expected by {@link SimpleDateFormat}. This options determines the
rollover schedule.
*/
- public
- void setDatePattern(String pattern) {
+ public void setDatePattern(String pattern) {
datePattern = pattern;
}
/** Returns the value of the <b>DatePattern</b> option. */
- public
- String getDatePattern() {
+ public String getDatePattern() {
return datePattern;
}
- public
- void activateOptions() {
+ public void activateOptions() {
super.activateOptions();
if(datePattern != null && fileName != null) {
now.setTime(System.currentTimeMillis());
@@ -212,8 +214,8 @@
scheduledFilename = fileName+sdf.format(new Date(file.lastModified()));
} else {
- LogLog.error("Either Filename or DatePattern options are not set for ["+
- name+"].");
+ LogLog.error("Either File or DatePattern options are not set for appender ["
+ +name+"].");
}
}
@@ -290,6 +292,9 @@
}
String datedFilename = fileName+sdf.format(now);
+ // It is too early to roll over because we are still within the
+ // bounds of the current interval. Rollover will occur once the
+ // next interval is reached.
if (scheduledFilename.equals(datedFilename)) {
return;
}
@@ -303,8 +308,12 @@
}
File file = new File(fileName);
- file.renameTo(target);
- LogLog.debug(fileName +" -> "+ scheduledFilename);
+ boolean result = file.renameTo(target);
+ if(result) {
+ LogLog.debug(fileName +" -> "+ scheduledFilename);
+ } else {
+ LogLog.error("Failed to rename ["+fileName+"] to ["+scheduledFilename+"].");
+ }
try {
// This will also close the file. This is OK since multiple
@@ -318,17 +327,14 @@
}
/**
- This method differentiates DailyRollingFileAppender from its
- super class.
-
- <p>Before actually logging, this method will check whether it is
- time to do a rollover. If it is, it will schedule the next
- rollover time and then rollover.
-
-
- */
- protected
- void subAppend(LoggingEvent event) {
+ * This method differentiates DailyRollingFileAppender from its
+ * super class.
+ *
+ * <p>Before actually logging, this method will check whether it is
+ * time to do a rollover. If it is, it will schedule the next
+ * rollover time and then rollover.
+ * */
+ protected void subAppend(LoggingEvent event) {
long n = System.currentTimeMillis();
if (n >= nextCheck) {
now.setTime(n);
@@ -345,16 +351,10 @@
}
/**
- RollingCalendar is a helper class to
- DailyRollingFileAppender. Using this class, it is easy to compute
- and access the next Millis().
-
- It subclasses the standard {@link GregorianCalendar}-object, to
- allow access to the protected function getTimeInMillis(), which it
- then exports.
-
- @author <a HREF="mailto:eirik.lygre@evita.no">Eirik Lygre</a> */
-
+ * RollingCalendar is a helper class to DailyRollingFileAppender.
+ * Given a periodicity type and the current time, it computes the
+ * start of the next interval.
+ * */
class RollingCalendar extends GregorianCalendar {
int type = DailyRollingFileAppender.TOP_OF_TROUBLE;
@@ -371,13 +371,11 @@
this.type = type;
}
- public
- long getNextCheckMillis(Date now) {
+ public long getNextCheckMillis(Date now) {
return getNextCheckDate(now).getTime();
}
- public
- Date getNextCheckDate(Date now) {
+ public Date getNextCheckDate(Date now) {
this.setTime(now);
switch(type) {
1.35 +8 -8 jakarta-log4j/src/java/org/apache/log4j/FileAppender.java
Index: FileAppender.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/FileAppender.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- FileAppender.java 25 Apr 2002 21:18:15 -0000 1.34
+++ FileAppender.java 9 Oct 2002 22:50:02 -0000 1.35
@@ -20,14 +20,14 @@
// Ben Sandee
/**
- FileAppender appends log events to a file.
-
- <p>Support for <code>java.io.Writer</code> and console appending
- has been deprecated and then removed. See the replacement
- solutions: {@link WriterAppender} and {@link ConsoleAppender}.
-
-
- @author Ceki Gülcü */
+ * FileAppender appends log events to a file.
+ *
+ * <p>Support for <code>java.io.Writer</code> and console appending
+ * has been deprecated and then removed. See the replacement
+ * solutions: {@link WriterAppender} and {@link ConsoleAppender}.
+ *
+ * @author Ceki Gülcü
+ * */
public class FileAppender extends WriterAppender {
/** Append to or truncate the file? The default value for this
1.28 +7 -7 jakarta-log4j/src/java/org/apache/log4j/HTMLLayout.java
Index: HTMLLayout.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/HTMLLayout.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- HTMLLayout.java 25 Apr 2002 21:18:15 -0000 1.27
+++ HTMLLayout.java 9 Oct 2002 22:50:02 -0000 1.28
@@ -130,22 +130,22 @@
sbuf.append("</td>" + Layout.LINE_SEP);
sbuf.append("<td title=\"Level\">");
- if (event.level.equals(Level.DEBUG)) {
+ if (event.getLevel().equals(Level.DEBUG)) {
sbuf.append("<font color=\"#339933\">");
- sbuf.append(event.level);
+ sbuf.append(event.getLevel());
sbuf.append("</font>");
}
- else if(event.level.isGreaterOrEqual(Level.WARN)) {
+ else if(event.getLevel().isGreaterOrEqual(Level.WARN)) {
sbuf.append("<font color=\"#993300\"><strong>");
- sbuf.append(event.level);
+ sbuf.append(event.getLevel());
sbuf.append("</strong></font>");
} else {
- sbuf.append(event.level);
+ sbuf.append(event.getLevel());
}
sbuf.append("</td>" + Layout.LINE_SEP);
- sbuf.append("<td title=\"" + event.categoryName + " category\">");
- sbuf.append(Transform.escapeTags(event.categoryName));
+ sbuf.append("<td title=\"" + event.getLoggerName() + " category\">");
+ sbuf.append(Transform.escapeTags(event.getLoggerName()));
sbuf.append("</td>" + Layout.LINE_SEP);
if(locationInfo) {
1.8 +52 -84 jakarta-log4j/src/java/org/apache/log4j/LogManager.java
Index: LogManager.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/LogManager.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- LogManager.java 11 Feb 2002 16:14:33 -0000 1.7
+++ LogManager.java 9 Oct 2002 22:50:02 -0000 1.8
@@ -23,84 +23,40 @@
import java.util.Enumeration;
/**
- Use the <code>LogManager</code> to retreive instances of {@link Logger}.
-
- @author Ceki Gülcü
-*/
+ * Use the <code>LogManager</code> class to retreive {@link Logger}
+ * instances or to operate on the current {@link
+ * LoggerRepository}. When the <code>LogManager</code> class is loaded
+ * into memory the default initalzation procedure is inititated. The
+ * default intialization procedure</a> is described in the <a
+ * href="../../../../manual.html#defaultInit">short log4j manual</a>.
+ *
+ * @author Ceki Gülcü */
public class LogManager {
/**
- This string constant is set to <b>log4j.properties</b> the name
- of the file that will be searched by default in classpath. If the
- file can be found, then it is fed to the {@link
- PropertyConfigurator}.
-
- See also {@link #DEFAULT_CONFIGURATION_KEY} for a more general
- alternative.
-
- <p>See also the full description of <a
- href="../../../../manual.html#defaultInit">default
- intialization</a> procedure.
-
- @since 0.8.5 */
- static public final String DEFAULT_CONFIGURATION_FILE = "log4j.properties";
-
- /**
- This string constant is set to <b>log4j.configuration</b>.
-
- <p>It corresponds to name of a system property that, if set,
- specifies the name of the resource containing the properties file
- or {@link URL} with which log4j should configure itself. See
- {@link OptionConverter#selectAndConfigure} for more detailed
- information on the processing of this option.
-
- <p>Setting the <b>log4j.configuration</b> system property
- overrides the default search for the file <b>log4j.properties</b>.
-
- <p>Note that all property keys are case sensitive.
-
- <p>See also the full description of <a
- href="../../../../manual.html#defaultInit">default
- intialization</a> procedure.
-
- @since 1.0 */
- static final public String DEFAULT_CONFIGURATION_KEY="log4j.configuration";
-
- /**
- This string constant is set to <b>log4j.configuratorClass</b>.
-
- <p>It corresponds to name of a system property that, if set,
- specifies the class name to use to automatically configure
- log4j. See {@link OptionConverter#selectAndConfigure} for more
- detailed information on the processing of this option.
-
- <p>Setting the <b>log4j.configuration</b> system property
- overrides the default search for the file <b>log4j.properties</b>.
-
- <p>Note that all property keys are case sensitive.
-
- <p>See also the full description of <a
- href="../../../../manual.html#defaultInit">default
- intialization</a> procedure.
+ * @deprecated This variable is for internal use only. It will
+ * become package protected in future versions.
+ * */
+ static public final String DEFAULT_CONFIGURATION_FILE = "log4j.properties";
+
+ static final String DEFAULT_XML_CONFIGURATION_FILE = "log4j.xml";
- @since 1.2 */
- static final public String CONFIGURATOR_CLASS_KEY="log4j.configuratorClass";
-
/**
- Setting the system property <b>log4j.defaultInitOverride</b> to
- "true" or any other value than "false" will skip default
- configuration process.
-
- <p>The current value of the DEFAULT_INIT_OVERRIDE_KEY string
- constant is <b>log4j.defaultInitOverride</b>.
-
- <p>See also the full description of <a
- href="../../../../manual.html#defaultInit">default
- intialization</a> procedure.
+ * @deprecated This variable is for internal use only. It will
+ * become private in future versions.
+ * */
+ static final public String DEFAULT_CONFIGURATION_KEY="log4j.configuration";
- <p>Note that all property keys are case sensitive.
+ /**
+ * @deprecated This variable is for internal use only. It will
+ * become private in future versions.
+ * */
+ static final public String CONFIGURATOR_CLASS_KEY="log4j.configuratorClass";
- @since 0.8.5 */
+ /**
+ * @deprecated This variable is for internal use only. It will
+ * become private in future versions.
+ */
public static final String DEFAULT_INIT_OVERRIDE_KEY =
"log4j.defaultInitOverride";
@@ -117,35 +73,47 @@
String override =OptionConverter.getSystemProperty(DEFAULT_INIT_OVERRIDE_KEY,
null);
- // if there is no default init override, them get the resource
+ // if there is no default init override, then get the resource
// specified by the user or the default config file.
if(override == null || "false".equalsIgnoreCase(override)) {
- String resource = OptionConverter.getSystemProperty(
- DEFAULT_CONFIGURATION_KEY,
- DEFAULT_CONFIGURATION_FILE);
+
+ String configurationOptionStr = OptionConverter.getSystemProperty(
+ DEFAULT_CONFIGURATION_KEY,
+ null);
String configuratorClassName = OptionConverter.getSystemProperty(
CONFIGURATOR_CLASS_KEY,
null);
URL url = null;
- try {
- // so, resource is not a URL:
- // attempt to get the resource from the class path
- url = new URL(resource);
- } catch (MalformedURLException ex) {
- url = Loader.getResource(resource);
- }
+
+ // if the user has not specified the log4j.configuration
+ // property, we search first for the file "log4j.xml" and then
+ // "log4j.properties"
+ if(configurationOptionStr == null) {
+ url = Loader.getResource(DEFAULT_XML_CONFIGURATION_FILE);
+ if(url == null) {
+ url = Loader.getResource(DEFAULT_CONFIGURATION_FILE);
+ }
+ } else {
+ try {
+ url = new URL(configurationOptionStr);
+ } catch (MalformedURLException ex) {
+ // so, resource is not a URL:
+ // attempt to get the resource from the class path
+ url = Loader.getResource(configurationOptionStr);
+ }
+ }
// If we have a non-null url, then delegate the rest of the
// configuration to the OptionConverter.selectAndConfigure
// method.
if(url != null) {
- LogLog.debug("Using URL ["+url+"] for automatic log4j configuration.");
+ LogLog.debug("Using URL ["+url+"] for automatic log4j configuration.");
OptionConverter.selectAndConfigure(url, configuratorClassName,
LogManager.getLoggerRepository());
} else {
- LogLog.debug("Could not find resource: ["+resource+"].");
+ LogLog.debug("Could not find resource: ["+configurationOptionStr+"].");
}
}
}
1.11 +10 -11 jakarta-log4j/src/java/org/apache/log4j/MDC.java
Index: MDC.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/MDC.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- MDC.java 21 Oct 2001 14:06:44 -0000 1.10
+++ MDC.java 9 Oct 2002 22:50:02 -0000 1.11
@@ -88,11 +88,10 @@
/**
- Get the current thread's MDC as a hashtable.
- */
- public
- static
- Hashtable getContext() {
+ * Get the current thread's MDC as a hashtable. This method is
+ * intended to be used internally.
+ * */
+ public static Hashtable getContext() {
return mdc.getContext0();
}
@@ -104,8 +103,8 @@
} else {
Hashtable ht = (Hashtable) ((ThreadLocalMap)tlm).get();
if(ht == null) {
- ht = new Hashtable(HT_SIZE);
- ((ThreadLocalMap)tlm).set(ht);
+ ht = new Hashtable(HT_SIZE);
+ ((ThreadLocalMap)tlm).set(ht);
}
ht.put(key, o);
}
@@ -117,10 +116,10 @@
return null;
} else {
Hashtable ht = (Hashtable) ((ThreadLocalMap)tlm).get();
- if(ht != null) {
- return ht.get(key);
+ if(ht != null && key != null) {
+ return ht.get(key);
} else {
- return null;
+ return null;
}
}
}
@@ -130,7 +129,7 @@
if(!java1) {
Hashtable ht = (Hashtable) ((ThreadLocalMap)tlm).get();
if(ht != null) {
- ht.remove(key);
+ ht.remove(key);
}
}
}
1.14 +2 -1 jakarta-log4j/src/java/org/apache/log4j/NDC.java
Index: NDC.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/NDC.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- NDC.java 3 Apr 2002 22:18:14 -0000 1.13
+++ NDC.java 9 Oct 2002 22:50:02 -0000 1.14
@@ -192,7 +192,8 @@
/**
- Used when printing the diagnostic context.
+ <font color="#FF4040"><b>Never use this method directly, use the {@link
+ org.apache.log4j.spi.LoggingEvent#getNDC} method instead.</b></font>
*/
static
public
1.55 +16 -11 jakarta-log4j/src/java/org/apache/log4j/PropertyConfigurator.java
Index: PropertyConfigurator.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/PropertyConfigurator.java,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- PropertyConfigurator.java 24 Apr 2002 15:03:44 -0000 1.54
+++ PropertyConfigurator.java 9 Oct 2002 22:50:02 -0000 1.55
@@ -33,8 +33,8 @@
import java.util.Hashtable;
/**
- Extends {@link BasicConfigurator} to provide configuration from an
- external file. See <b>{@link #doConfigure(String, LoggerRepository)}</b> for the
+ Allows the configuration of log4j from an external file. See
+ <b>{@link #doConfigure(String, LoggerRepository)}</b> for the
expected format.
<p>It is sometimes useful to see how log4j is reading configuration
@@ -100,7 +100,7 @@
/**
Read configuration from a file. <b>The existing configuration is
not cleared nor reset.</b> If you require a different behavior,
- then call {@link BasicConfigurator#resetConfiguration
+ then call {@link LogManager#resetConfiguration
resetConfiguration} method before calling
<code>doConfigure</code>.
@@ -118,7 +118,7 @@
</pre>
<p>The level value can consist of the string values OFF, FATAL,
- ERROR, WARN, INFO, DEBUG, ALL or a <em>custom level</e> value. A
+ ERROR, WARN, INFO, DEBUG, ALL or a <em>custom level</em> value. A
custom level value can be specified in the form
level#classname. By default the repository-wide threshold is set
to the lowest possible value, namely the level <code>ALL</code>.
@@ -175,7 +175,7 @@
<p>For non-root categories the syntax is almost the same:
<pre>
- log4j.logger.logger_name=[level|INHERITED], appenderName, appenderName, ...
+ log4j.logger.logger_name=[level|INHERITED|NULL], appenderName, appenderName, ...
</pre>
<p>The meaning of the optional level value is discussed above
@@ -187,9 +187,10 @@
named logger remains untouched.
<p>By default categories inherit their level from the
- hierarchy. However, if you set the level of a logger and
- later decide that that logger should inherit its level, then
- you should specify INHERITED as the value for the level value.
+ hierarchy. However, if you set the level of a logger and later
+ decide that that logger should inherit its level, then you should
+ specify INHERITED as the value for the level value. NULL is a
+ synonym for INHERITED.
<p>Similar to the root logger syntax, each <i>appenderName</i>
(separated by commas) will be attached to the named logger.
@@ -576,9 +577,13 @@
// If the level value is inherited, set category level value to
// null. We also check that the user has not specified inherited for the
// root category.
- if(levelStr.equalsIgnoreCase(INHERITED) &&
- !loggerName.equals(INTERNAL_ROOT_NAME)) {
- logger.setLevel(null);
+ if(INHERITED.equalsIgnoreCase(levelStr) ||
+ NULL.equalsIgnoreCase(levelStr)) {
+ if(loggerName.equals(INTERNAL_ROOT_NAME)) {
+ LogLog.warn("The root logger cannot be set to null.");
+ } else {
+ logger.setLevel(null);
+ }
} else {
logger.setLevel(OptionConverter.toLevel(levelStr, (Level) Level.DEBUG));
}
1.2 +2 -2 jakarta-log4j/src/java/org/apache/log4j/Receiver.java
Index: Receiver.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/Receiver.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Receiver.java 20 Sep 2002 05:30:55 -0000 1.1
+++ Receiver.java 9 Oct 2002 22:50:02 -0000 1.2
@@ -58,8 +58,8 @@
// if the logger level is greater or equal to the level
// of the event, use the logger to append the event.
if(event.level.isGreaterOrEqual(localLogger.getEffectiveLevel())) {
- // set the logger for the event
- event.logger = localLogger;
+ // set the logger for the event
+ // event.logger = localLogger;
// call the loggers appenders to process the event
localLogger.callAppenders(event);
1.11 +1 -1 jakarta-log4j/src/java/org/apache/log4j/SimpleLayout.java
Index: SimpleLayout.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/SimpleLayout.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- SimpleLayout.java 3 Apr 2002 22:18:14 -0000 1.10
+++ SimpleLayout.java 9 Oct 2002 22:50:02 -0000 1.11
@@ -49,7 +49,7 @@
String format(LoggingEvent event) {
sbuf.setLength(0);
- sbuf.append(event.level.toString());
+ sbuf.append(event.getLevel().toString());
sbuf.append(" - ");
sbuf.append(event.getRenderedMessage());
sbuf.append(LINE_SEP);
1.17 +2 -2 jakarta-log4j/src/java/org/apache/log4j/TTCCLayout.java
Index: TTCCLayout.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/TTCCLayout.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- TTCCLayout.java 9 May 2002 20:15:01 -0000 1.16
+++ TTCCLayout.java 9 Oct 2002 22:50:02 -0000 1.17
@@ -175,11 +175,11 @@
buf.append(event.getThreadName());
buf.append("] ");
}
- buf.append(event.level.toString());
+ buf.append(event.getLevel().toString());
buf.append(' ');
if(this.categoryPrefixing) {
- buf.append(event.categoryName);
+ buf.append(event.getLoggerName());
buf.append(' ');
}
1.24 +11 -16 jakarta-log4j/src/java/org/apache/log4j/WriterAppender.java
Index: WriterAppender.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/WriterAppender.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- WriterAppender.java 7 May 2002 23:24:51 -0000 1.23
+++ WriterAppender.java 9 Oct 2002 22:50:02 -0000 1.24
@@ -194,17 +194,18 @@
writeFooter();
reset();
}
+
/**
- Close the underlying {@link java.io.Writer}.
- */
- protected
- void closeWriter() {
+ * Close the underlying {@link java.io.Writer}.
+ * */
+ protected void closeWriter() {
if(qw != null) {
try {
qw.close();
} catch(IOException e) {
- LogLog.error("Could not close " + qw, e); // do need to invoke an error handler
- // at this late stage
+ // There is do need to invoke an error handler at this late
+ // stage.
+ LogLog.error("Could not close " + qw, e);
}
}
}
@@ -234,13 +235,11 @@
return retval;
}
- public
- String getEncoding() {
+ public String getEncoding() {
return encoding;
}
- public
- void setEncoding(String value) {
+ public void setEncoding(String value) {
encoding = value;
}
@@ -250,9 +249,7 @@
/**
Set the {@link ErrorHandler} for this WriterAppender and also the
underlying {@link QuietWriter} if any. */
- public
- synchronized
- void setErrorHandler(ErrorHandler eh) {
+ public synchronized void setErrorHandler(ErrorHandler eh) {
if(eh == null) {
LogLog.warn("You have tried to set a null error-handler.");
} else {
@@ -275,9 +272,7 @@
<p><b>WARNING:</b> Logging to an unopened Writer will fail.
<p>
@param writer An already opened Writer. */
- public
- synchronized
- void setWriter(Writer writer) {
+ public synchronized void setWriter(Writer writer) {
reset();
this.qw = new QuietWriter(writer, errorHandler);
//this.tp = new TracerPrintWriter(qw);
1.2 +2 -2 jakarta-log4j/src/java/org/apache/log4j/chainsaw/EventDetails.java
Index: EventDetails.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/chainsaw/EventDetails.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EventDetails.java 23 Mar 2002 07:51:26 -0000 1.1
+++ EventDetails.java 9 Oct 2002 22:50:02 -0000 1.2
@@ -73,8 +73,8 @@
EventDetails(LoggingEvent aEvent) {
this(aEvent.timeStamp,
- aEvent.level,
- aEvent.categoryName,
+ aEvent.getLevel(),
+ aEvent.getLoggerName(),
aEvent.getNDC(),
aEvent.getThreadName(),
aEvent.getRenderedMessage(),
1.15 +2 -3 jakarta-log4j/src/java/org/apache/log4j/config/PropertySetter.java
Index: PropertySetter.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/config/PropertySetter.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- PropertySetter.java 20 May 2002 09:52:57 -0000 1.14
+++ PropertySetter.java 9 Oct 2002 22:50:02 -0000 1.15
@@ -3,8 +3,7 @@
*
* This software is published under the terms of the Apache Software
* License version 1.1, a copy of which has been included with this
- * distribution in the LICENSE.txtfile. */
-
+ * distribution in the LICENSE.txt file. */
// Contributors: Georg Lundesgaard
package org.apache.log4j.config;
@@ -155,7 +154,7 @@
setProperty(prop, name, value);
} catch (PropertySetterException ex) {
LogLog.warn("Failed to set property [" + name +
- "] to value \"" + value + "\". " + ex.getMessage());
+ "] to value \"" + value + "\". ", ex.rootCause);
}
}
}
1.7 +2 -2 jakarta-log4j/src/java/org/apache/log4j/helpers/AppenderAttachableImpl.java
Index: AppenderAttachableImpl.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/helpers/AppenderAttachableImpl.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- AppenderAttachableImpl.java 17 Nov 2001 01:04:22 -0000 1.6
+++ AppenderAttachableImpl.java 9 Oct 2002 22:50:03 -0000 1.7
@@ -121,8 +121,8 @@
/**
- Remove all previously attached appenders.
- */
+ * Remove and close all previously attached appenders.
+ * */
public
void removeAllAppenders() {
if(appenderList != null) {
1.18 +80 -54 jakarta-log4j/src/java/org/apache/log4j/helpers/Loader.java
Index: Loader.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/helpers/Loader.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- Loader.java 24 Apr 2002 21:25:32 -0000 1.17
+++ Loader.java 9 Oct 2002 22:50:03 -0000 1.18
@@ -8,6 +8,10 @@
package org.apache.log4j.helpers;
import java.net.URL;
+import java.lang.IllegalAccessException;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+
//import java.awt.Image;
//import java.awt.Toolkit;
@@ -23,7 +27,9 @@
// We conservatively assume that we are running under Java 1.x
static private boolean java1 = true;
-
+
+ static private boolean ignoreTCL = false;
+
static {
String prop = OptionConverter.getSystemProperty("java.version", null);
@@ -34,6 +40,10 @@
java1 = false;
}
}
+ String ignoreTCLProp = OptionConverter.getSystemProperty("log4j.ignoreTCL", null);
+ if(ignoreTCLProp != null) {
+ ignoreTCL = OptionConverter.toBoolean(ignoreTCLProp, true);
+ }
}
/**
@@ -54,43 +64,37 @@
built-in class loader in JDK 1.1.
</ol>
-
*/
- static
- public
- URL getResource(String resource) {
+ static public URL getResource(String resource) {
ClassLoader classLoader = null;
URL url = null;
try {
- if(!java1) {
- classLoader = Thread.currentThread().getContextClassLoader();
- if(classLoader != null) {
- LogLog.debug("Trying to find ["+resource+"] using context classloader "
- +classLoader+".");
- url = classLoader.getResource(resource);
- if(url != null) {
- return url;
- }
- }
- }
-
- // We could not find resource. Ler us now try with the
- // classloader that loaded this class.
- classLoader = Loader.class.getClassLoader();
- if(classLoader == null) {
- LogLog.warn("Loader.class.getClassLoader returned null!");
- } else {
-
- LogLog.debug("Trying to find ["+resource+"] using "+classLoader
- +" class loader.");
- url = classLoader.getResource(resource);
- if(url != null) {
- return url;
- }
- }
+ if(!java1) {
+ classLoader = getTCL();
+ if(classLoader != null) {
+ LogLog.debug("Trying to find ["+resource+"] using context classloader "
+ +classLoader+".");
+ url = classLoader.getResource(resource);
+ if(url != null) {
+ return url;
+ }
+ }
+ }
+
+ // We could not find resource. Ler us now try with the
+ // classloader that loaded this class.
+ classLoader = Loader.class.getClassLoader();
+ if(classLoader != null) {
+ LogLog.debug("Trying to find ["+resource+"] using "+classLoader
+ +" class loader.");
+ url = classLoader.getResource(resource);
+ if(url != null) {
+ return url;
+ }
+ }
} catch(Throwable t) {
- LogLog.warn(TSTR, t);
+ LogLog.warn(TSTR, t);
}
// Last ditch attempt: get the resource from the class path. It
@@ -98,7 +102,7 @@
// loader which the parent of the system class loader. Hence the
// code below.
LogLog.debug("Trying to find ["+resource+
- "] using ClassLoader.getSystemResource().");
+ "] using ClassLoader.getSystemResource().");
return ClassLoader.getSystemResource(resource);
}
@@ -111,28 +115,50 @@
return java1;
}
+ /**
+ * Get the Thread Context Loader which is a JDK 1.2 feature. If we
+ * are running under JDK 1.1 or anything else goes wrong the method
+ * returns <code>null<code>.
+ *
+ * */
+ private static ClassLoader getTCL() throws IllegalAccessException,
+ InvocationTargetException {
+
+ // Are we running on a JDK 1.2 or later system?
+ Method method = null;
+ try {
+ method = Thread.class.getMethod("getContextClassLoader", null);
+ } catch (NoSuchMethodException e) {
+ // We are running on JDK 1.1
+ return null;
+ }
+
+ return (ClassLoader) method.invoke(Thread.currentThread(), null);
+ }
+
+
/**
- Load the specified class using the <code>Thread</code>
- <code>contextClassLoader</code> if running under Java2 or current
- class loader if running under JDK 1.1.
- */
- static
- public
- Class loadClass (Double clazz) throws ClassNotFoundException {
- return null;
- // if(java1) {
- // return Class.forName(clazz);
- // } else {
- // try {
- // return Thread.currentThread().getContextClassLoader().loadClass(clazz);
- // } catch(Exception e) {
- // // we reached here because
- // // currentThread().getContextClassLoader() is null or because
- // // of a security exceptio, or because clazz could not be
- // // loaded, in any case we now try one more time
- // return Class.forName(clazz);
- // }
- // }
+ * If running under JDK 1.2 load the specified class using the
+ * <code>Thread</code> <code>contextClassLoader</code> if that
+ * fails try Class.forname. Under JDK 1.1 only Class.forName is
+ * used.
+ *
+ */
+ static public Class loadClass (String clazz) throws ClassNotFoundException {
+ // Just call Class.forName(clazz) if we are running under JDK 1.1
+ // or if we are instructed to ignore the TCL.
+ if(java1 || ignoreTCL) {
+ return Class.forName(clazz);
+ } else {
+ try {
+ return getTCL().loadClass(clazz);
+ } catch(Throwable e) {
+ // we reached here because tcl was null or because of a
+ // security exception, or because clazz could not be loaded...
+ // In any case we now try one more time
+ return Class.forName(clazz);
+ }
+ }
}
}
1.5 +1 -3 jakarta-log4j/src/java/org/apache/log4j/helpers/NullEnumeration.java
Index: NullEnumeration.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/helpers/NullEnumeration.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- NullEnumeration.java 5 Jul 2001 19:09:42 -0000 1.4
+++ NullEnumeration.java 9 Oct 2002 22:50:03 -0000 1.5
@@ -25,9 +25,7 @@
NullEnumeration() {
}
- public
- static
- NullEnumeration getInstance() {
+ public static NullEnumeration getInstance() {
return instance;
}
1.37 +6 -2 jakarta-log4j/src/java/org/apache/log4j/helpers/OptionConverter.java
Index: OptionConverter.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/helpers/OptionConverter.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- OptionConverter.java 9 May 2002 15:43:43 -0000 1.36
+++ OptionConverter.java 9 Oct 2002 22:50:03 -0000 1.37
@@ -199,7 +199,7 @@
+ ":pri=[" + levelName + "]");
try {
- Class customLevel = Class.forName(clazz);
+ Class customLevel = Loader.loadClass(clazz);
// get a ref to the specified class' static method
// toLevel(String, org.apache.log4j.Level)
@@ -306,10 +306,14 @@
Object defaultValue) {
if(className != null) {
try {
- Class classObj = Class.forName(className);
+ Class classObj = Loader.loadClass(className);
if(!superClass.isAssignableFrom(classObj)) {
LogLog.error("A \""+className+"\" object is not assignable to a \""+
superClass.getName() + "\" variable.");
+ LogLog.error("The class \""+ superClass.getName()+"\" was loaded by ");
+ LogLog.error("["+superClass.getClassLoader()+"] whereas object of type ");
+ LogLog.error("\"" +classObj.getName()+"\" was loaded by ["
+ +classObj.getClassLoader()+"].");
return defaultValue;
}
return classObj.newInstance();
1.18 +2 -2 jakarta-log4j/src/java/org/apache/log4j/helpers/PatternParser.java
Index: PatternParser.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/helpers/PatternParser.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- PatternParser.java 24 Apr 2002 01:16:13 -0000 1.17
+++ PatternParser.java 9 Oct 2002 22:50:03 -0000 1.18
@@ -388,7 +388,7 @@
case THREAD_CONVERTER:
return event.getThreadName();
case LEVEL_CONVERTER:
- return event.level.toString();
+ return event.getLevel().toString();
case NDC_CONVERTER:
return event.getNDC();
case MESSAGE_CONVERTER: {
@@ -538,7 +538,7 @@
}
String getFullyQualifiedName(LoggingEvent event) {
- return event.categoryName;
+ return event.getLoggerName();
}
}
}
1.4 +2 -2 jakarta-log4j/src/java/org/apache/log4j/helpers/SyslogWriter.java
Index: SyslogWriter.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/helpers/SyslogWriter.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SyslogWriter.java 5 Jul 2001 19:09:47 -0000 1.3
+++ SyslogWriter.java 9 Oct 2002 22:50:03 -0000 1.4
@@ -61,8 +61,8 @@
public
void write(String string) throws IOException {
- DatagramPacket packet = new DatagramPacket(string.getBytes(),
- string.length(),
+ byte[] bytes = string.getBytes();
+ DatagramPacket packet = new DatagramPacket(bytes, bytes.length,
address, SYSLOG_PORT);
if(this.ds != null)
1.2 +47 -8 jakarta-log4j/src/java/org/apache/log4j/helpers/Transform.java
Index: Transform.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/helpers/Transform.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Transform.java 26 Apr 2002 12:31:42 -0000 1.1
+++ Transform.java 9 Oct 2002 22:50:03 -0000 1.2
@@ -12,21 +12,28 @@
/**
Utility class for transforming strings.
+
+ @author Ceki Gülcü
+ @author Michael A. McAngus
*/
public class Transform {
+ private static final String CDATA_START = "<![CDATA[";
+ private static final String CDATA_END = "]]>";
+ private static final String CDATA_PSEUDO_END = "]]>";
+ private static final String CDATA_EMBEDED_END = CDATA_END + CDATA_PSEUDO_END + CDATA_START;
+ private static final int CDATA_END_LEN = CDATA_END.length();
+
/**
- * This method takes a string which may contain HTML tags (ie, <b>, <table>,
- * etc) and converts the '<' and '>' characters to their HTML escape
- * sequences.
+ * This method takes a string which may contain HTML tags (ie,
+ * <b>, <table>, etc) and replaces any '<' and '>'
+ * characters with respective predefined entity references.
*
* @param input The text to be converted.
* @return The input string with the characters '<' and '>' replaced with
- * < and > respectively.
- */
- static
- public
- String escapeTags(String input) {
+ * &lt; and &gt; respectively.
+ * */
+ static public String escapeTags(String input) {
//Check if the string is null or zero length -- if so, return
//what was sent in.
@@ -52,5 +59,37 @@
}
}
return buf.toString();
+ }
+
+ /**
+ * Ensures that embeded CDEnd strings (]]>) are handled properly
+ * within message, NDC and throwable tag text.
+ *
+ * @param buf StringBuffer holding the XML data to this point. The
+ * initial CDStart (<![CDATA[) and final CDEnd (]]>) of the CDATA
+ * section are the responsibility of the calling method.
+ * @param str The String that is inserted into an existing CDATA Section within buf.
+ * */
+ static public void appendEscapingCDATA(StringBuffer buf, String str) {
+ int end = str.indexOf(CDATA_END);
+
+ if (end < 0) {
+ buf.append(str);
+ return;
+ }
+
+ int start = 0;
+ while (end > -1) {
+ buf.append(str.substring(start,end));
+ buf.append(CDATA_EMBEDED_END);
+ start = end + CDATA_END_LEN;
+ if (start < str.length()) {
+ end = str.indexOf(CDATA_END, start);
+ } else {
+ return;
+ }
+ }
+
+ buf.append(str.substring(start));
}
}
1.7 +9 -4 jakarta-log4j/src/java/org/apache/log4j/jdbc/JDBCAppender.java
Index: JDBCAppender.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/jdbc/JDBCAppender.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- JDBCAppender.java 24 Apr 2002 21:25:32 -0000 1.6
+++ JDBCAppender.java 9 Oct 2002 22:50:03 -0000 1.7
@@ -14,8 +14,13 @@
/**
- The JDBCAppender provides for sending log events to a database.
+ <p><b><font color="#FF2222">WARNING: This version of JDBCAppender
+ is very likely to be completely replaced in the future. Moreoever,
+ it does not log exceptions.</font></b> </p>
+ The JDBCAppender provides for sending log events to a database.
+
+
<p>Each append call adds to an <code>ArrayList</code> buffer. When
the buffer is filled each log event is placed in a sql statement
(configurable) and executed.
@@ -247,10 +252,10 @@
/**
- * JDBCAppender builds a layout internally if one is not provided.
- */
+ * JDBCAppender requires a layout.
+ * */
public boolean requiresLayout() {
- return false;
+ return true;
}
1.2 +3 -3 jakarta-log4j/src/java/org/apache/log4j/lf5/LF5Appender.java
Index: LF5Appender.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/lf5/LF5Appender.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LF5Appender.java 26 Apr 2002 15:48:42 -0000 1.1
+++ LF5Appender.java 9 Oct 2002 22:50:03 -0000 1.2
@@ -88,11 +88,11 @@
*/
public void append(LoggingEvent event) {
// Retrieve the information from the log4j LoggingEvent.
- String category = event.categoryName;
+ String category = event.getLoggerName();
String logMessage = event.getRenderedMessage();
String nestedDiagnosticContext = event.getNDC();
String threadDescription = event.getThreadName();
- String level = event.level.toString();
+ String level = event.getLevel().toString();
long time = event.timeStamp;
LocationInfo locationInfo = event.getLocationInformation();
@@ -255,4 +255,4 @@
// Nested Top-Level Classes or Interfaces:
//--------------------------------------------------------------------------
-}
\ No newline at end of file
+}
1.2 +4 -25 jakarta-log4j/src/java/org/apache/log4j/lf5/viewer/LogBrokerMonitor.java
Index: LogBrokerMonitor.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/lf5/viewer/LogBrokerMonitor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LogBrokerMonitor.java 26 Apr 2002 15:48:43 -0000 1.1
+++ LogBrokerMonitor.java 9 Oct 2002 22:50:04 -0000 1.2
@@ -12,7 +12,6 @@
import org.apache.log4j.lf5.LogRecordFilter;
import org.apache.log4j.lf5.util.DateFormatManager;
import org.apache.log4j.lf5.util.LogFileParser;
-import org.apache.log4j.lf5.util.ProductProperties;
import org.apache.log4j.lf5.util.StreamUtils;
import org.apache.log4j.lf5.viewer.categoryexplorer.CategoryExplorerTree;
import org.apache.log4j.lf5.viewer.categoryexplorer.CategoryPath;
@@ -475,8 +474,6 @@
//
// Configure the Frame.
//
- ProductProperties props = ProductProperties.getInstance();
-
_logMonitorFrame = new JFrame("LogFactor5");
_logMonitorFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
@@ -1070,8 +1067,6 @@
JMenu helpMenu = new JMenu("Help");
helpMenu.setMnemonic('h');
helpMenu.add(createHelpProperties());
- helpMenu.addSeparator();
- helpMenu.add(createHelpAbout());
return helpMenu;
}
@@ -1096,25 +1091,6 @@
);
}
- protected JMenuItem createHelpAbout() {
- JMenuItem aboutMI = new JMenuItem("About LogFactor5...");
- aboutMI.setMnemonic('a');
- //aboutMI.setAccelerator( KeyStroke.getKeyStroke("control A") );
-
- aboutMI.addActionListener(
- new ActionListener() {
- protected LogFactor5AboutDialog dialog =
- new LogFactor5AboutDialog(_logMonitorFrame);
-
- public void actionPerformed(ActionEvent e) {
- dialog.show();
- }
- }
-
- );
- return aboutMI;
- }
-
protected JMenu createEditMenu() {
JMenu editMenu = new JMenu("Edit");
editMenu.setMnemonic('e');
@@ -1216,7 +1192,10 @@
_fontSizeCombo = fontSizeCombo;
ClassLoader cl = this.getClass().getClassLoader();
- URL newIconURL = cl.getResource("org/apache/log4j/viewer/" +
+ if(cl == null) {
+ cl = ClassLoader.getSystemClassLoader();
+ }
+ URL newIconURL = cl.getResource("org/apache/log4j/lf5/viewer/" +
"images/channelexplorer_new.gif");
ImageIcon newIcon = null;
1.2 +1 -2 jakarta-log4j/src/java/org/apache/log4j/lf5/viewer/configure/ConfigurationManager.java
Index: ConfigurationManager.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/lf5/viewer/configure/ConfigurationManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ConfigurationManager.java 26 Apr 2002 15:48:43 -0000 1.1
+++ ConfigurationManager.java 9 Oct 2002 22:50:04 -0000 1.2
@@ -330,8 +330,7 @@
protected String getFilename() {
String home = System.getProperty("user.home");
- String sep = (home.startsWith(MRUFileManager.UNIX_SEPARATOR))
- ? MRUFileManager.UNIX_SEPARATOR : MRUFileManager.DOS_SEPARATOR;
+ String sep = System.getProperty("file.separator");
return home + sep + "lf5" + sep + CONFIG_FILE_NAME;
}
1.2 +3 -7 jakarta-log4j/src/java/org/apache/log4j/lf5/viewer/configure/MRUFileManager.java
Index: MRUFileManager.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/lf5/viewer/configure/MRUFileManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MRUFileManager.java 26 Apr 2002 15:48:43 -0000 1.1
+++ MRUFileManager.java 9 Oct 2002 22:50:04 -0000 1.2
@@ -29,8 +29,6 @@
//--------------------------------------------------------------------------
private static final String CONFIG_FILE_NAME = "mru_file_manager";
private static final int DEFAULT_MAX_SIZE = 3;
- public static final String UNIX_SEPARATOR = "/";
- public static final String DOS_SEPARATOR = "\\";
//--------------------------------------------------------------------------
// Protected Variables:
@@ -74,7 +72,6 @@
// do nothing
e.printStackTrace();
}
-
}
/**
@@ -112,7 +109,6 @@
return null;
}
-
/**
* Adds a file name to the MRU file list.
*/
@@ -168,7 +164,7 @@
*/
public static void createConfigurationDirectory() {
String home = System.getProperty("user.home");
- String sep = (home.startsWith(UNIX_SEPARATOR)) ? UNIX_SEPARATOR : DOS_SEPARATOR;
+ String sep = System.getProperty("file.separator");
File f = new File(home + sep + "lf5");
if (!f.exists()) {
try {
@@ -253,7 +249,7 @@
protected String getFilename() {
String home = System.getProperty("user.home");
- String sep = (home.startsWith(UNIX_SEPARATOR)) ? UNIX_SEPARATOR : DOS_SEPARATOR;
+ String sep = System.getProperty("file.separator");
return home + sep + "lf5" + sep + CONFIG_FILE_NAME;
}
@@ -264,7 +260,7 @@
protected void setMaxSize(int maxSize) {
if (maxSize < _mruFileList.size()) {
for (int i = 0; i < _mruFileList.size() - maxSize; i++) {
- _mruFileList.removeFirst();
+ _mruFileList.removeLast();
}
}
1.14 +230 -31 jakarta-log4j/src/java/org/apache/log4j/net/JMSAppender.java
Index: JMSAppender.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/net/JMSAppender.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- JMSAppender.java 24 Apr 2002 01:16:12 -0000 1.13
+++ JMSAppender.java 9 Oct 2002 22:50:04 -0000 1.14
@@ -12,26 +12,99 @@
import org.apache.log4j.spi.ErrorCode;
import org.apache.log4j.helpers.LogLog;
-import javax.jms.*;
+import java.util.Properties;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.Topic;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
+import javax.jms.Session;
+import javax.jms.ObjectMessage;
import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
/**
- A simple appender based on JMS.
+ * A simple appender that publishes events to a JMS Topic. The events
+ * are serialized and transmitted as JMS message type {@link
+ * ObjectMessage}.
+
+ * <p>JMS {@link Topic topics} and {@link TopicConnectionFactory topic
+ * connection factories} are administered objects that are retrieved
+ * using JNDI messaging which in turn requires the retreival of a JNDI
+ * {@link Context}.
+
+ * <p>There are two common methods for retrieving a JNDI {@link
+ * Context}. If a file resource named <em>jndi.properties</em> is
+ * available to the JNDI API, it will use the information found
+ * therein to retrieve an initial JNDI context. To obtain an initial
+ * context, your code will simply call:
+
+ <pre>
+ InitialContext jndiContext = new InitialContext();
+ </pre>
+
+ * <p>Calling the no-argument <code>InitialContext()</code> method
+ * will also work from within Enterprise Java Beans (EJBs) because it
+ * is part of the EJB contract for application servers to provide each
+ * bean an environment naming context (ENC).
+
+ * <p>In the second approach, several predetermined properties are set
+ * and these properties are passed to the <code>InitialContext</code>
+ * contructor to connect to the naming service provider. For example,
+ * to connect to JBoss naming service one would write:
+
+<pre>
+ Properties env = new Properties( );
+ env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
+ env.put(Context.PROVIDER_URL, "jnp://hostname:1099");
+ env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
+ InitialContext jndiContext = new InitialContext(env);
+</pre>
+
+ * where <em>hostname</em> is the host where the JBoss applicaiton
+ * server is running.
+ *
+ * <p>To connect to the the naming service of Weblogic application
+ * server one would write:
+
+<pre>
+ Properties env = new Properties( );
+ env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
+ env.put(Context.PROVIDER_URL, "t3://localhost:7001");
+ InitialContext jndiContext = new InitialContext(env);
+</pre>
+
+ * <p>Other JMS providers will obviously require different values.
+ *
+ * The initial JNDI context can be obtained by calling the
+ * no-argument <code>InitialContext()</code> method in EJBs. Only
+ * clients running in a separate JVM need to be concerned about the
+ * <em>jndi.properties</em> file and calling {@link
+ * InitialContext#InitialContext()} or alternatively correctly
+ * setting the different properties before calling {@link
+ * InitialContext#InitialContext(java.util.Hashtable)} method.
- @author Ceki Gülcü
-*/
+
+ @author Ceki Gülcü */
public class JMSAppender extends AppenderSkeleton {
- TopicConnection topicConnection;
- TopicSession topicSession;
- TopicPublisher topicPublisher;
+ String securityPrincipalName;
+ String securityCredentials;
+ String initialContextFactoryName;
+ String urlPkgPrefixes;
+ String providerURL;
String topicBindingName;
String tcfBindingName;
+ String userName;
+ String password;
boolean locationInfo;
+ TopicConnection topicConnection;
+ TopicSession topicSession;
+ TopicPublisher topicPublisher;
+
public
JMSAppender() {
}
@@ -82,31 +155,75 @@
return locationInfo;
}
- public
- void activateOptions() {
+ /**
+ * Options are activated and become effective only after calling
+ * this method.*/
+ public void activateOptions() {
TopicConnectionFactory topicConnectionFactory;
try {
- Context ctx = new InitialContext();
- topicConnectionFactory = (TopicConnectionFactory) lookup(ctx, tcfBindingName);
- topicConnection = topicConnectionFactory.createTopicConnection();
- topicConnection.start();
+ Context jndi;
+ LogLog.debug("Getting initial context.");
+ if(initialContextFactoryName != null) {
+ Properties env = new Properties( );
+ env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactoryName);
+ if(providerURL != null) {
+ env.put(Context.PROVIDER_URL, providerURL);
+ } else {
+ LogLog.warn("You have set InitialContextFactoryName option but not the "
+ +"ProviderURL. This is likely to cause problems.");
+ }
+ if(urlPkgPrefixes != null) {
+ env.put(Context.URL_PKG_PREFIXES, urlPkgPrefixes);
+ }
+
+ if(securityPrincipalName != null) {
+ env.put(Context.SECURITY_PRINCIPAL, securityPrincipalName);
+ if(securityCredentials != null) {
+ env.put(Context.SECURITY_CREDENTIALS, securityCredentials);
+ } else {
+ LogLog.warn("You have set SecurityPrincipalName option but not the "
+ +"SecurityCredentials. This is likely to cause problems.");
+ }
+ }
+ jndi = new InitialContext(env);
+ } else {
+ jndi = new InitialContext();
+ }
+
+ LogLog.debug("Looking up ["+tcfBindingName+"]");
+ topicConnectionFactory = (TopicConnectionFactory) lookup(jndi, tcfBindingName);
+ LogLog.debug("About to create TopicConnection.");
+ if(userName != null) {
+ topicConnection = topicConnectionFactory.createTopicConnection(userName,
+ password);
+ } else {
+ topicConnection = topicConnectionFactory.createTopicConnection();
+ }
+
+ LogLog.debug("Creating TopicSession, non-transactional, "
+ +"in AUTO_ACKNOWLEDGE mode.");
topicSession = topicConnection.createTopicSession(false,
Session.AUTO_ACKNOWLEDGE);
- Topic topic = (Topic) lookup(ctx, topicBindingName);
+ LogLog.debug("Looking up topic name ["+topicBindingName+"].");
+ Topic topic = (Topic) lookup(jndi, topicBindingName);
+
+ LogLog.debug("Creating TopicPublisher.");
topicPublisher = topicSession.createPublisher(topic);
+
+ LogLog.debug("Starting TopicConnection.");
+ topicConnection.start();
- ctx.close();
+ jndi.close();
} catch(Exception e) {
errorHandler.error("Error while activating options for appender named ["+name+
"].", e, ErrorCode.GENERIC_FAILURE);
}
}
- protected
- Object lookup(Context ctx, String name) throws NamingException {
+ protected Object lookup(Context ctx, String name) throws NamingException {
try {
return ctx.lookup(name);
} catch(NameNotFoundException e) {
@@ -115,8 +232,7 @@
}
}
- protected
- boolean checkEntryConditions() {
+ protected boolean checkEntryConditions() {
String fail = null;
if(this.topicConnection == null) {
@@ -138,9 +254,9 @@
/**
Close this JMSAppender. Closing releases all resources used by the
appender. A closed appender cannot be re-opened. */
- public
- synchronized // avoid concurrent append and close operations
- void close() {
+ public synchronized void close() {
+ // The synchronized modifier avoids concurrent append and close operations
+
if(this.closed)
return;
@@ -164,8 +280,7 @@
/**
This method called by {@link AppenderSkeleton#doAppend} method to
do most of the real appending work. */
- public
- void append(LoggingEvent event) {
+ public void append(LoggingEvent event) {
if(!checkEntryConditions()) {
return;
}
@@ -184,17 +299,101 @@
}
/**
- If true, the information sent to the remote subscriber will include
- location information. By default no location information is sent
- to the subscriber. */
- public
- void setLocationInfo(boolean locationInfo) {
+ * Returns the value of the <b>InitialContextFactoryName</b> option.
+ * See {@link #setInitialContextFactoryName} for more details on the
+ * meaning of this option.
+ * */
+ public String getInitialContextFactoryName() {
+ return initialContextFactoryName;
+ }
+
+ /**
+ * Setting the <b>InitialContextFactoryName</b> method will cause
+ * this <code>JMSAppender</code> instance to use the {@link
+ * InitialContext#InitialContext(Hashtable)} method instead of the
+ * no-argument constructor. If you set this option, you should also
+ * at least set the <b>ProviderURL</b> option.
+ *
+ * <p>See also {@link #setProviderURL(String)}.
+ * */
+ public void setInitialContextFactoryName(String initialContextFactoryName) {
+ this.initialContextFactoryName = initialContextFactoryName;
+ }
+
+ public String getProviderURL() {
+ return providerURL;
+ }
+
+ public void setProviderURL(String providerURL) {
+ this.providerURL = providerURL;
+ }
+
+ String getURLPkgPrefixes( ) {
+ return urlPkgPrefixes;
+ }
+
+ public void setURLPkgPrefixes(String urlPkgPrefixes ) {
+ this.urlPkgPrefixes = urlPkgPrefixes;
+ }
+
+ public String getSecurityCredentials() {
+ return securityCredentials;
+ }
+
+ public void setSecurityCredentials(String securityCredentials) {
+ this.securityCredentials = securityCredentials;
+ }
+
+
+ public String getSecurityPrincipalName() {
+ return securityPrincipalName;
+ }
+
+ public void setSecurityPrincipalName(String securityPrincipalName) {
+ this.securityPrincipalName = securityPrincipalName;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ /**
+ * The user name to use when {@link
+ * TopicConnectionFactory#createTopicConnection(String, String)
+ * creating a topic session}. If you set this option, you should
+ * also set the <b>Password</b> option. See {@link
+ * #setPassword(String)}.
+ * */
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ /**
+ * The paswword to use when creating a topic session.
+ */
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+
+ /**
+ If true, the information sent to the remote subscriber will
+ include caller's location information. By default no location
+ information is sent to the subscriber. */
+ public void setLocationInfo(boolean locationInfo) {
this.locationInfo = locationInfo;
}
- public
- boolean requiresLayout() {
+ /**
+ * The JMSAppender sends serialized events and consequently does not
+ * require a layout.
+ * */
+ public boolean requiresLayout() {
return false;
}
}
1.13 +85 -42 jakarta-log4j/src/java/org/apache/log4j/net/JMSSink.java
Index: JMSSink.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/net/JMSSink.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- JMSSink.java 24 Apr 2002 01:16:12 -0000 1.12
+++ JMSSink.java 9 Oct 2002 22:50:04 -0000 1.13
@@ -8,43 +8,83 @@
package org.apache.log4j.net;
import org.apache.log4j.spi.LoggingEvent;
-import org.apache.log4j.Category;
+import org.apache.log4j.Logger;
import org.apache.log4j.LogManager;
import org.apache.log4j.spi.RendererSupport;
import org.apache.log4j.spi.LoggerRepository;
import org.apache.log4j.or.jms.MessageRenderer;
import org.apache.log4j.PropertyConfigurator;
+import org.apache.log4j.xml.DOMConfigurator;
import org.apache.log4j.helpers.LogLog;
-import javax.jms.*;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.TopicConnection;
+import javax.jms.Topic;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicSubscriber;
+import javax.jms.Session;
+import javax.jms.TopicSession;
+import javax.jms.ObjectMessage;
+import javax.jms.JMSException;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
+import java.util.Properties;
/**
- A simple application receiving the logging events sent by a JMSAppender.
-
+ * A simple application that consumes logging events sent by a {@link
+ * JMSAppender}.
+ *
+ *
+ * @author Ceki Gülcü
+ * */
+public class JMSSink implements javax.jms.MessageListener {
- @author Ceki Gülcü
-*/
-public class JMSSink {
+ static Logger logger = Logger.getLogger(JMSSink.class);
- static public void main(String[] args) {
- if(args.length != 3) {
+ static public void main(String[] args) throws Exception {
+ if(args.length != 5) {
usage("Wrong number of arguments.");
}
-
+
String tcfBindingName = args[0];
String topicBindingName = args[1];
- PropertyConfigurator.configure(args[2]);
-
- LoggerRepository rep = LogManager.getLoggerRepository();
- if(rep instanceof RendererSupport) {
- ((RendererSupport) rep).setRenderer(Message.class, new MessageRenderer());
+ String username = args[2];
+ String password = args[3];
+
+
+ String configFile = args[4];
+
+ if(configFile.endsWith(".xml")) {
+ new DOMConfigurator().configure(configFile);
+ } else {
+ new PropertyConfigurator().configure(configFile);
}
+
+ new JMSSink(tcfBindingName, topicBindingName, username, password);
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ // Loop until the word "exit" is typed
+ System.out.println("Type \"exit\" to quit JMSSink.");
+ while(true){
+ String s = stdin.readLine( );
+ if (s.equalsIgnoreCase("exit")) {
+ System.out.println("Exiting. Kill the application if it does not exit "
+ + "due to daemon threads.");
+ return;
+ }
+ }
+ }
+
+ public JMSSink( String tcfBindingName, String topicBindingName, String username,
+ String password) {
+
try {
Context ctx = new InitialContext();
TopicConnectionFactory topicConnectionFactory;
@@ -52,7 +92,8 @@
tcfBindingName);
TopicConnection topicConnection =
- topicConnectionFactory.createTopicConnection();
+ topicConnectionFactory.createTopicConnection(username,
+ password);
topicConnection.start();
TopicSession topicSession = topicConnection.createTopicSession(false,
@@ -60,47 +101,49 @@
Topic topic = (Topic)ctx.lookup(topicBindingName);
- //TopicSubscriber topicSubscriber = topicSession.createSubscriber(topic);
- TopicSubscriber topicSubscriber =
- topicSession.createDurableSubscriber(topic, "x");
-
-
- LoggingEvent event;
- Category remoteCategory;
-
- while(true) {
- ObjectMessage msg = (ObjectMessage)topicSubscriber.receive();
- event = (LoggingEvent) msg.getObject();
- remoteCategory = Category.getInstance(event.categoryName);
- remoteCategory.callAppenders(event);
-
- // dump the JMSMessage
- // remoteCategory.debug(msg);
+ TopicSubscriber topicSubscriber = topicSession.createSubscriber(topic);
+
+ topicSubscriber.setMessageListener(this);
- }
} catch(Exception e) {
- LogLog.error("Could not read JMS message.", e);
+ logger.error("Could not read JMS message.", e);
}
}
+ public void onMessage(javax.jms.Message message) {
+ LoggingEvent event;
+ Logger remoteLogger;
- protected
- static
- Object lookup(Context ctx, String name) throws NamingException {
+ try {
+ if(message instanceof ObjectMessage) {
+ ObjectMessage objectMessage = (ObjectMessage) message;
+ event = (LoggingEvent) objectMessage.getObject();
+ remoteLogger = Logger.getLogger(event.getLoggerName());
+ remoteLogger.callAppenders(event);
+ } else {
+ logger.warn("Received message is of type "+message.getJMSType()
+ +", was expecting ObjectMessage.");
+ }
+ } catch(JMSException jmse) {
+ logger.error("Exception thrown while processing incoming message.",
+ jmse);
+ }
+ }
+
+
+ protected static Object lookup(Context ctx, String name) throws NamingException {
try {
return ctx.lookup(name);
} catch(NameNotFoundException e) {
- LogLog.error("Could not find name ["+name+"].");
+ logger.error("Could not find name ["+name+"].");
throw e;
}
}
-
- static
- void usage(String msg) {
+ static void usage(String msg) {
System.err.println(msg);
System.err.println("Usage: java " + JMSSink.class.getName()
- + " TopicConnectionFactoryBindingName TopicBindingName configFile");
+ + " TopicConnectionFactoryBindingName TopicBindingName username password configFile");
System.exit(1);
}
}
1.5 +26 -23 jakarta-log4j/src/java/org/apache/log4j/net/SimpleSocketServer.java
Index: SimpleSocketServer.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/net/SimpleSocketServer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SimpleSocketServer.java 20 May 2002 09:52:57 -0000 1.4
+++ SimpleSocketServer.java 9 Oct 2002 22:50:04 -0000 1.5
@@ -13,23 +13,24 @@
import org.apache.log4j.Category;
import org.apache.log4j.LogManager;
import org.apache.log4j.PropertyConfigurator;
+import org.apache.log4j.xml.DOMConfigurator;
/**
- A simple {@link SocketNode} based server.
-
+ * A simple {@link SocketNode} based server.
+ *
<pre>
- <b>Usage:</b> java org.apache.log4j.net.SimpleSocketServer port configFile
+ <b>Usage:</b> java org.apache.log4j.net.SimpleSocketServer port configFile
- where <em>port</em> is a part number where the server listens and
- <em>configFile</em> is a configuration file fed to the {@link
- PropertyConfigurator}.
+ where <em>port</em> is a part number where the server listens and
+ <em>configFile</em> is a configuration file fed to the {@link
+ PropertyConfigurator} or to {@link DOMConfigurator} if an XML file.
</pre>
-
- @author Ceki Gülcü
-
- @since 0.8.4 */
-
+ *
+ * @author Ceki Gülcü
+ *
+ * @since 0.8.4
+ * */
public class SimpleSocketServer {
static Category cat = Category.getInstance(SimpleSocketServer.class.getName());
@@ -39,11 +40,12 @@
public
static
void main(String argv[]) {
- if(argv.length == 2)
+ if(argv.length == 2) {
init(argv[0], argv[1]);
- else
+ } else {
usage("Wrong number of arguments.");
-
+ }
+
try {
cat.info("Listening on port " + port);
ServerSocket serverSocket = new ServerSocket(port);
@@ -55,30 +57,31 @@
new Thread(new SocketNode(socket,
LogManager.getLoggerRepository())).start();
}
- }
- catch(Exception e) {
+ } catch(Exception e) {
e.printStackTrace();
}
}
- static
- void usage(String msg) {
+ static void usage(String msg) {
System.err.println(msg);
System.err.println(
"Usage: java " +SimpleSocketServer.class.getName() + " port configFile");
System.exit(1);
}
- static
- void init(String portStr, String configFile) {
+ static void init(String portStr, String configFile) {
try {
port = Integer.parseInt(portStr);
- }
- catch(java.lang.NumberFormatException e) {
+ } catch(java.lang.NumberFormatException e) {
e.printStackTrace();
usage("Could not interpret port number ["+ portStr +"].");
}
- PropertyConfigurator.configure(configFile);
+
+ if(configFile.endsWith(".xml")) {
+ new DOMConfigurator().configure(configFile);
+ } else {
+ new PropertyConfigurator().configure(configFile);
+ }
}
}
1.13 +38 -58 jakarta-log4j/src/java/org/apache/log4j/net/SocketAppender.java
Index: SocketAppender.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/net/SocketAppender.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- SocketAppender.java 24 Apr 2002 01:16:12 -0000 1.12
+++ SocketAppender.java 9 Oct 2002 22:50:04 -0000 1.13
@@ -128,8 +128,7 @@
/**
Connects to remote server at <code>address</code> and <code>port</code>.
*/
- public
- SocketAppender(InetAddress address, int port) {
+ public SocketAppender(InetAddress address, int port) {
this.address = address;
this.remoteHost = address.getHostName();
this.port = port;
@@ -139,8 +138,7 @@
/**
Connects to remote server at <code>host</code> and <code>port</code>.
*/
- public
- SocketAppender(String host, int port) {
+ public SocketAppender(String host, int port) {
this.port = port;
this.address = getAddressByName(host);
this.remoteHost = host;
@@ -150,19 +148,17 @@
/**
Connect to the specified <b>RemoteHost</b> and <b>Port</b>.
*/
- public
- void activateOptions() {
+ public void activateOptions() {
connect(address, port);
}
/**
- Close this appender.
- <p>This will mark the appender as closed and
- call then {@link #cleanUp} method.
- */
- synchronized
- public
- void close() {
+ * Close this appender.
+ *
+ * <p>This will mark the appender as closed and call then {@link
+ * #cleanUp} method.
+ * */
+ synchronized public void close() {
if(closed)
return;
@@ -171,16 +167,14 @@
}
/**
- Drop the connection to the remote host and release the underlying
- connector thread if it has been created
- */
- public
- void cleanUp() {
+ * Drop the connection to the remote host and release the underlying
+ * connector thread if it has been created
+ * */
+ public void cleanUp() {
if(oos != null) {
try {
oos.close();
- }
- catch(IOException e) {
+ } catch(IOException e) {
LogLog.error("Could not close oos.", e);
}
oos = null;
@@ -199,8 +193,7 @@
// First, close the previous connection if any.
cleanUp();
oos = new ObjectOutputStream(new Socket(address, port).getOutputStream());
- }
- catch(IOException e) {
+ } catch(IOException e) {
LogLog.error("Could not connect to remote log4j server at ["
+address.getHostName()+"]. We will try again later.", e);
fireConnector();
@@ -208,8 +201,7 @@
}
- public
- void append(LoggingEvent event) {
+ public void append(LoggingEvent event) {
if(event == null)
return;
@@ -234,8 +226,7 @@
//System.err.println("Doing oos.reset()");
oos.reset();
}
- }
- catch(IOException e) {
+ } catch(IOException e) {
oos = null;
LogLog.warn("Detected problem with connection: "+e);
if(reconnectionDelay > 0) {
@@ -259,28 +250,26 @@
InetAddress getAddressByName(String host) {
try {
return InetAddress.getByName(host);
- }
- catch(Exception e) {
+ } catch(Exception e) {
LogLog.error("Could not find address of ["+host+"].", e);
return null;
}
}
/**
- The SocketAppender does not use a layout. Hence, this method returns
- <code>false</code>.
- */
- public
- boolean requiresLayout() {
+ * The SocketAppender does not use a layout. Hence, this method
+ * returns <code>false</code>.
+ * */
+ public boolean requiresLayout() {
return false;
}
/**
- The <b>RemoteHost</b> option takes a string value which should be
- the host name of the server where a {@link SocketNode} is running.
- */
- public
- void setRemoteHost(String host) {
+ * The <b>RemoteHost</b> option takes a string value which should be
+ * the host name of the server where a {@link SocketNode} is
+ * running.
+ * */
+ public void setRemoteHost(String host) {
address = getAddressByName(host);
remoteHost = host;
}
@@ -288,8 +277,7 @@
/**
Returns value of the <b>RemoteHost</b> option.
*/
- public
- String getRemoteHost() {
+ public String getRemoteHost() {
return remoteHost;
}
@@ -297,16 +285,14 @@
The <b>Port</b> option takes a positive integer representing
the port where the server is waiting for connections.
*/
- public
- void setPort(int port) {
+ public void setPort(int port) {
this.port = port;
}
/**
Returns value of the <b>Port</b> option.
*/
- public
- int getPort() {
+ public int getPort() {
return port;
}
@@ -315,16 +301,14 @@
the information sent to the remote host will include location
information. By default no location information is sent to the server.
*/
- public
- void setLocationInfo(boolean locationInfo) {
+ public void setLocationInfo(boolean locationInfo) {
this.locationInfo = locationInfo;
}
/**
Returns value of the <b>LocationInfo</b> option.
*/
- public
- boolean getLocationInfo() {
+ public boolean getLocationInfo() {
return locationInfo;
}
@@ -337,16 +321,14 @@
<p>Setting this option to zero turns off reconnection
capability.
*/
- public
- void setReconnectionDelay(int delay) {
+ public void setReconnectionDelay(int delay) {
this.reconnectionDelay = delay;
}
/**
Returns value of the <b>ReconnectionDelay</b> option.
*/
- public
- int getReconnectionDelay() {
+ public int getReconnectionDelay() {
return reconnectionDelay;
}
@@ -377,18 +359,16 @@
synchronized(this) {
oos = new ObjectOutputStream(socket.getOutputStream());
connector = null;
+ LogLog.debug("Connection established. Exiting connector thread.");
break;
}
- }
- catch(InterruptedException e) {
+ } catch(InterruptedException e) {
LogLog.debug("Connector interrupted. Leaving loop.");
return;
- }
- catch(java.net.ConnectException e) {
+ } catch(java.net.ConnectException e) {
LogLog.debug("Remote host "+address.getHostName()
+" refused connection.");
- }
- catch(IOException e) {
+ } catch(IOException e) {
LogLog.debug("Could not connect to " + address.getHostName()+
". Exception is " + e);
}
1.22 +7 -3 jakarta-log4j/src/java/org/apache/log4j/net/SocketNode.java
Index: SocketNode.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/net/SocketNode.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- SocketNode.java 20 Sep 2002 05:33:10 -0000 1.21
+++ SocketNode.java 9 Oct 2002 22:50:04 -0000 1.22
@@ -76,6 +76,7 @@
try {
while(true) {
+ // read an event from the wire
event = (LoggingEvent) ois.readObject();
// if configured with a receiver, tell it to post the event
@@ -83,15 +84,18 @@
receiver.doPost(event);
// else post it via the hierarchy
} else {
+ // get a logger from the hierarchy. The name of the logger
+ // is taken to be the name contained in the event.
remoteLogger = hierarchy.getLogger(event.categoryName);
- event.logger = remoteLogger;
+ //event.logger = remoteLogger;
+ // apply the logger-level filter
if(event.level.isGreaterOrEqual(remoteLogger.getEffectiveLevel())) {
+ // finally log the event as if was generated locally
remoteLogger.callAppenders(event);
}
}
}
- }
- catch(java.io.EOFException e) {
+ } catch(java.io.EOFException e) {
logger.info("Caught java.io.EOFException closing conneciton.");
} catch(java.net.SocketException e) {
logger.info("Caught java.net.SocketException closing conneciton.");
1.17 +2 -2 jakarta-log4j/src/java/org/apache/log4j/net/SyslogAppender.java
Index: SyslogAppender.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/net/SyslogAppender.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- SyslogAppender.java 20 May 2002 09:52:57 -0000 1.16
+++ SyslogAppender.java 9 Oct 2002 22:50:04 -0000 1.17
@@ -228,7 +228,7 @@
public
void append(LoggingEvent event) {
- if(!isAsSevereAsThreshold(event.level))
+ if(!isAsSevereAsThreshold(event.getLevel()))
return;
// We must not attempt to append if sqw is null.
@@ -241,7 +241,7 @@
String buffer = (facilityPrinting? facilityStr : "") +
layout.format(event);
- sqw.setLevel(event.level.getSyslogEquivalent());
+ sqw.setLevel(event.getLevel().getSyslogEquivalent());
sqw.write(buffer);
String[] s = event.getThrowableStrRep();
1.17 +1 -1 jakarta-log4j/src/java/org/apache/log4j/nt/NTEventLogAppender.java
Index: NTEventLogAppender.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/nt/NTEventLogAppender.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- NTEventLogAppender.java 20 May 2002 09:52:57 -0000 1.16
+++ NTEventLogAppender.java 9 Oct 2002 22:50:04 -0000 1.17
@@ -110,7 +110,7 @@
}
}
// Normalize the log message level into the supported categories
- int nt_category = event.level.toInt();
+ int nt_category = event.getLevel().toInt();
// Anything above FATAL or below DEBUG is labeled as INFO.
//if (nt_category > FATAL || nt_category < DEBUG) {
1.11 +2 -1 jakarta-log4j/src/java/org/apache/log4j/or/RendererMap.java
Index: RendererMap.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/or/RendererMap.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- RendererMap.java 20 May 2002 09:52:57 -0000 1.10
+++ RendererMap.java 9 Oct 2002 22:50:04 -0000 1.11
@@ -9,6 +9,7 @@
import org.apache.log4j.spi.RendererSupport;
import org.apache.log4j.helpers.LogLog;
+import org.apache.log4j.helpers.Loader;
import org.apache.log4j.helpers.OptionConverter;
import java.util.Hashtable;
@@ -46,7 +47,7 @@
return;
} else {
try {
- Class renderedClass = Class.forName(renderedClassName);
+ Class renderedClass = Loader.loadClass(renderedClassName);
repository.setRenderer(renderedClass, renderer);
} catch(ClassNotFoundException e) {
LogLog.error("Could not find class ["+renderedClassName+"].", e);
1.3 +25 -28 jakarta-log4j/src/java/org/apache/log4j/performance/NOPWriter.java
Index: NOPWriter.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/performance/NOPWriter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NOPWriter.java 14 Dec 2000 21:08:08 -0000 1.2
+++ NOPWriter.java 9 Oct 2002 22:50:05 -0000 1.3
@@ -1,5 +1,9 @@
-// Copyright 1996-1999, International Business Machines
-// Corporation. All Rights Reserved.
+/*
+ * Copyright (C) The Apache Software Foundation. All rights reserved.
+ *
+ * This software is published under the terms of the Apache Software
+ * License version 1.1, a copy of which has been included with this
+ * distribution in the LICENSE.txt file. */
package org.apache.log4j.performance;
@@ -7,42 +11,35 @@
import java.io.IOException;
/**
- Extends {@link Writer} with methods that return immediately without
- doing anything. This class is used to measure the cost of
- constructing a log message but not actually writing to the
- OutputStream.
-
- @author Ceki Gülcü
-*/
+ * <p>Extends {@link Writer} with methods that return immediately
+ * without doing anything. This class is used to measure the cost of
+ * constructing a log message but not actually writing to any device.
+ * </p>
+
+ * <p><b> <font color="#FF2222">The
+ * <code>org.apache.log4j.performance.NOPWriter</code> class is
+ * intended for internal use only.</font> Consequently, it is not
+ * included in the <em>log4j.jar</em> file.</b> </p>
+ *
+ * @author Ceki Gülcü
+ * */
public class NOPWriter extends Writer {
- //public
- //NOPWriter() {
- //}
-
+ public void write(char[] cbuf) throws IOException {}
- public
- void write(char[] cbuf) throws IOException {}
+ public void write(char[] cbuf, int off, int len) throws IOException {}
- public
- void write(char[] cbuf, int off, int len) throws IOException {}
+ public void write(int b) throws IOException {}
- public
- void write(int b) throws IOException {}
+ public void write(String s) throws IOException {}
- public
- void write(String s) throws IOException {}
+ public void write(String s, int off, int len) throws IOException {}
- public
- void write(String s, int off, int len) throws IOException {}
-
- public
- void flush() throws IOException {
+ public void flush() throws IOException {
}
- public
- void close() throws IOException {
+ public void close() throws IOException {
System.err.println("Close called.");
}
}
1.5 +1 -1 jakarta-log4j/src/java/org/apache/log4j/performance/NewVsSetLen.java
Index: NewVsSetLen.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/performance/NewVsSetLen.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- NewVsSetLen.java 20 May 2002 09:52:58 -0000 1.4
+++ NewVsSetLen.java 9 Oct 2002 22:50:05 -0000 1.5
@@ -160,7 +160,7 @@
for(int second = 0; second < 16;) {
System.out.println("SECOND loop="+second +", RUN_LENGTH="
+RUN_LENGTH+", len="+len);
- t = (int)newBuffer(len, second);;
+ t = (int)newBuffer(len, second);
System.out.print("<td>" + t);
t = (int)setLen(len, second);
1.5 +8 -3 jakarta-log4j/src/java/org/apache/log4j/performance/NullAppender.java
Index: NullAppender.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/performance/NullAppender.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- NullAppender.java 20 May 2002 09:52:58 -0000 1.4
+++ NullAppender.java 9 Oct 2002 22:50:05 -0000 1.5
@@ -12,9 +12,14 @@
import org.apache.log4j.AppenderSkeleton;
/**
- A bogus appender which calls the format method of its layout object
- but does not write the result anywhere.
- */
+ * A bogus appender which calls the format method of its layout object
+ * but does not write the result anywhere.
+ *
+ * <p><b> <font color="#FF2222">The
+ * <code>org.apache.log4j.performance.NullAppender</code> class is
+ * intended for internal use only.</font> Consequently, it is not
+ * included in the <em>log4j.jar</em> file.</b> </p>
+ * */
public class NullAppender extends AppenderSkeleton {
public static String s;
1.5 +50 -0 jakarta-log4j/src/java/org/apache/log4j/performance/logging
Index: logging
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/performance/logging,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- logging 9 May 2002 19:53:37 -0000 1.4
+++ logging 9 Oct 2002 22:50:05 -0000 1.5
@@ -251,6 +251,56 @@
multiRun xml/logging$TEST.xml 8 "PatternLayout \"$format\"" $SHORTRUN
fi
+echo -------------------------------------
+echo "FileAppender: BufferedIO=true"
+echo -------------------------------------
+
+TEST=220
+if [ $TEST -ge $start ]; then
+ multiRun xml/logging$TEST.xml 8 "SimpleLayout" $LONGRUN
+fi
+
+TEST=221
+if [ $TEST -ge $start ]; then
+ format="%p - %m%n"
+ multiRun xml/logging$TEST.xml 8 "PatternLayout \"$format\"" $LONGRUN
+fi
+
+TEST=222
+if [ $TEST -ge $start ]; then
+ multiRun xml/logging$TEST.xml 8 "TTCC/RELATIVE" $LONGRUN
+fi
+
+TEST=223
+if [ $TEST -ge $start ]; then
+ format="%r [%t] %-5p %c - %m%n"
+ multiRun xml/logging$TEST.xml 8 "PatternLayout \"$format\"" $LONGRUN
+fi
+
+TEST=224
+if [ $TEST -ge $start ]; then
+ multiRun xml/logging$TEST.xml 8 "TTCCLayout/ISO8601" $LONGRUN
+fi
+
+TEST=225
+if [ $TEST -ge $start ]; then
+ format="%d{ISO8601} [%t] %-5p %c %x - %m%n"
+ multiRun xml/logging$TEST.xml 8 "PatternLayout \"$format\"" $LONGRUN
+fi
+
+TEST=226
+if [ $TEST -ge $start ]; then
+ format="%d{yyyy-MM-dd HH:mm:ss,SSS} [%t] %-5p %c %x - %m%n"
+ multiRun xml/logging$TEST.xml 8 "PatternLayout \"$format\"" $LONGRUN
+fi
+
+TEST=227
+if [ $TEST -ge $start ]; then
+ format="%l - %m%n"
+ multiRun xml/logging$TEST.xml 8 "PatternLayout \"$format\"" $SHORTRUN
+fi
+
+
echo ==================================
echo Async appender
echo ==================================
1.2 +12 -8 jakarta-log4j/src/java/org/apache/log4j/performance/package.html
Index: package.html
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/performance/package.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- package.html 14 Dec 2000 09:31:33 -0000 1.1
+++ package.html 9 Oct 2002 22:50:05 -0000 1.2
@@ -3,13 +3,17 @@
<title></title>
</head>
-<body>
-<p>Package to measure the performance of the different log4j components.
+ <body>
+ <p>Package to measure the performance of the different log4j
+ components.
+ </p>
-<hr>
-<address></address>
-<!-- hhmts start -->
-Last modified: Thu Dec 16 10:32:43 MET 1999
-<!-- hhmts end -->
-</body> </html>
+ <p><b> <font color="#FF2222">The
+ <code>org.apache.log4j.performance</code> package is intended
+ for internal use only.</font> Consequently, the classes in this
+ package are not included in the <em>log4j.jar</em> file.</b>
+ </p>
+
+ </body>
+</html>
1.5 +18 -18 jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging201.xml
Index: logging201.xml
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging201.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- logging201.xml 14 Jun 2001 10:07:16 -0000 1.4
+++ logging201.xml 9 Oct 2002 22:50:05 -0000 1.5
@@ -2,23 +2,23 @@
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
- <appender name="NULL" class="org.apache.log4j.FileAppender">
- <param name="File" value="temp"/>
- <param name="Append" value="false"/>
- <param name="ImmediateFlush" value="false"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
- value="%p - %m%n"/>
- </layout>
- </appender>
-
- <category name="A0123456789">
- <priority value ="info" />
- </category>
-
- <root>
- <priority value ="debug" />
- <appender-ref ref="NULL" />
- </root>
+ <appender name="NULL" class="org.apache.log4j.FileAppender">
+ <param name="File" value="temp"/>
+ <param name="Append" value="false"/>
+ <param name="ImmediateFlush" value="false"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="%p - %m%n"/>
+ </layout>
+ </appender>
+
+ <category name="A0123456789">
+ <priority value ="info" />
+ </category>
+
+ <root>
+ <priority value ="debug" />
+ <appender-ref ref="NULL" />
+ </root>
</log4j:configuration>
1.5 +18 -18 jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging202.xml
Index: logging202.xml
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging202.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- logging202.xml 14 Jun 2001 10:07:17 -0000 1.4
+++ logging202.xml 9 Oct 2002 22:50:05 -0000 1.5
@@ -2,22 +2,22 @@
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
- <appender name="NULL" class="org.apache.log4j.FileAppender">
- <param name="File" value="temp"/>
- <param name="Append" value="false"/>
- <param name="ImmediateFlush" value="false"/>
- <layout class="org.apache.log4j.TTCCLayout">
- <param name="DateFormat" value="RELATIVE"/>
- </layout>
- </appender>
-
- <category name="A0123456789">
- <priority value ="info" />
- </category>
-
- <root>
- <priority value ="debug" />
- <appender-ref ref="NULL" />
- </root>
-
+ <appender name="NULL" class="org.apache.log4j.FileAppender">
+ <param name="File" value="temp"/>
+ <param name="Append" value="false"/>
+ <param name="ImmediateFlush" value="false"/>
+ <layout class="org.apache.log4j.TTCCLayout">
+ <param name="DateFormat" value="RELATIVE"/>
+ </layout>
+ </appender>
+
+ <category name="A0123456789">
+ <priority value ="info" />
+ </category>
+
+ <root>
+ <priority value ="debug" />
+ <appender-ref ref="NULL" />
+ </root>
+
</log4j:configuration>
1.5 +18 -18 jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging203.xml
Index: logging203.xml
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging203.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- logging203.xml 14 Jun 2001 10:07:18 -0000 1.4
+++ logging203.xml 9 Oct 2002 22:50:05 -0000 1.5
@@ -2,23 +2,23 @@
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
- <appender name="NULL" class="org.apache.log4j.FileAppender">
- <param name="File" value="temp"/>
- <param name="Append" value="false"/>
- <param name="ImmediateFlush" value="false"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
- value="%r [%t] %-5p %c - %m%n"/>
- </layout>
- </appender>
-
- <category name="A0123456789">
- <priority value ="info" />
- </category>
-
- <root>
- <priority value ="debug" />
- <appender-ref ref="NULL" />
- </root>
+ <appender name="NULL" class="org.apache.log4j.FileAppender">
+ <param name="File" value="temp"/>
+ <param name="Append" value="false"/>
+ <param name="ImmediateFlush" value="false"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="%r [%t] %-5p %c - %m%n"/>
+ </layout>
+ </appender>
+
+ <category name="A0123456789">
+ <priority value ="info" />
+ </category>
+
+ <root>
+ <priority value ="debug" />
+ <appender-ref ref="NULL" />
+ </root>
</log4j:configuration>
1.5 +19 -19 jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging204.xml
Index: logging204.xml
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging204.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- logging204.xml 14 Jun 2001 10:07:18 -0000 1.4
+++ logging204.xml 9 Oct 2002 22:50:05 -0000 1.5
@@ -2,23 +2,23 @@
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
- <appender name="NULL" class="org.apache.log4j.FileAppender">
- <param name="File" value="temp"/>
- <param name="Append" value="false"/>
- <param name="ImmediateFlush" value="false"/>
- <layout class="org.apache.log4j.TTCCLayout">
- <param name="DateFormat"
- value="ISO8601"/>
- </layout>
- </appender>
-
- <category name="A0123456789">
- <priority value ="info" />
- </category>
-
- <root>
- <priority value ="debug" />
- <appender-ref ref="NULL" />
- </root>
-
+ <appender name="NULL" class="org.apache.log4j.FileAppender">
+ <param name="File" value="temp"/>
+ <param name="Append" value="false"/>
+ <param name="ImmediateFlush" value="false"/>
+ <layout class="org.apache.log4j.TTCCLayout">
+ <param name="DateFormat"
+ value="ISO8601"/>
+ </layout>
+ </appender>
+
+ <category name="A0123456789">
+ <priority value ="info" />
+ </category>
+
+ <root>
+ <priority value ="debug" />
+ <appender-ref ref="NULL" />
+ </root>
+
</log4j:configuration>
1.5 +19 -19 jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging205.xml
Index: logging205.xml
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging205.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- logging205.xml 14 Jun 2001 10:07:19 -0000 1.4
+++ logging205.xml 9 Oct 2002 22:50:05 -0000 1.5
@@ -2,23 +2,23 @@
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
- <appender name="NULL" class="org.apache.log4j.FileAppender">
- <param name="File" value="temp"/>
- <param name="Append" value="false"/>
- <param name="ImmediateFlush" value="false"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
- value="%d{ISO8601} [%t] %-5p %c %x - %m%n"/>
- </layout>
- </appender>
-
- <category name="A0123456789">
- <priority value ="info" />
- </category>
-
- <root>
- <priority value ="debug" />
- <appender-ref ref="NULL" />
- </root>
-
+ <appender name="NULL" class="org.apache.log4j.FileAppender">
+ <param name="File" value="temp"/>
+ <param name="Append" value="false"/>
+ <param name="ImmediateFlush" value="false"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="%d{ISO8601} [%t] %-5p %c %x - %m%n"/>
+ </layout>
+ </appender>
+
+ <category name="A0123456789">
+ <priority value ="info" />
+ </category>
+
+ <root>
+ <priority value ="debug" />
+ <appender-ref ref="NULL" />
+ </root>
+
</log4j:configuration>
1.5 +19 -19 jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging206.xml
Index: logging206.xml
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging206.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- logging206.xml 14 Jun 2001 10:07:19 -0000 1.4
+++ logging206.xml 9 Oct 2002 22:50:05 -0000 1.5
@@ -2,23 +2,23 @@
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
- <appender name="NULL" class="org.apache.log4j.FileAppender">
- <param name="File" value="temp"/>
- <param name="Append" value="false"/>
- <param name="ImmediateFlush" value="false"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
- value="%d{yyyy-MM-dd HH:mm:ss,SSS} [%t] %-5p %c %x - %m%n"/>
- </layout>
- </appender>
-
- <category name="A0123456789">
- <priority value ="info" />
- </category>
-
- <root>
- <priority value ="debug" />
- <appender-ref ref="NULL" />
- </root>
-
+ <appender name="NULL" class="org.apache.log4j.FileAppender">
+ <param name="File" value="temp"/>
+ <param name="Append" value="false"/>
+ <param name="ImmediateFlush" value="false"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="%d{yyyy-MM-dd HH:mm:ss,SSS} [%t] %-5p %c %x - %m%n"/>
+ </layout>
+ </appender>
+
+ <category name="A0123456789">
+ <priority value ="info" />
+ </category>
+
+ <root>
+ <priority value ="debug" />
+ <appender-ref ref="NULL" />
+ </root>
+
</log4j:configuration>
1.5 +17 -17 jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging207.xml
Index: logging207.xml
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging207.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- logging207.xml 14 Jun 2001 10:07:20 -0000 1.4
+++ logging207.xml 9 Oct 2002 22:50:05 -0000 1.5
@@ -2,23 +2,23 @@
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
- <appender name="NULL" class="org.apache.log4j.FileAppender">
- <param name="File" value="temp"/>
- <param name="Append" value="false"/>
- <param name="ImmediateFlush" value="false"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
- value="%l - %m%n"/>
- </layout>
- </appender>
+ <appender name="NULL" class="org.apache.log4j.FileAppender">
+ <param name="File" value="temp"/>
+ <param name="Append" value="false"/>
+ <param name="ImmediateFlush" value="false"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="%l - %m%n"/>
+ </layout>
+ </appender>
- <category name="A0123456789">
- <priority value ="info" />
- </category>
-
- <root>
- <priority value ="debug" />
- <appender-ref ref="NULL" />
- </root>
+ <category name="A0123456789">
+ <priority value ="info" />
+ </category>
+
+ <root>
+ <priority value ="debug" />
+ <appender-ref ref="NULL" />
+ </root>
</log4j:configuration>
1.2 +23 -0 jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging220.xml
1.2 +25 -0 jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging221.xml
1.2 +24 -0 jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging222.xml
1.2 +25 -0 jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging223.xml
1.2 +25 -0 jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging224.xml
1.2 +25 -0 jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging225.xml
1.2 +25 -0 jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging226.xml
1.2 +25 -0 jakarta-log4j/src/java/org/apache/log4j/performance/xml/logging227.xml
1.9 +8 -14 jakarta-log4j/src/java/org/apache/log4j/spi/Configurator.java
Index: Configurator.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/spi/Configurator.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Configurator.java 28 Sep 2001 13:37:48 -0000 1.8
+++ Configurator.java 9 Oct 2002 22:50:06 -0000 1.9
@@ -19,22 +19,16 @@
public interface Configurator {
/**
- <p><code>ENABLE_KEY</code> is the name of the constant
- holding the string value <b>log4j.enable</b>.
-
- <p>Setting the system property <b>log4j.disable</b> to DEBUG,
- INFO, WARN, ERROR or FATAL is equivalent to calling the {@link
- Hierarchy#disable} method with the corresponding level.
-
- @since 1.2 */
- // public static final String ENABLE_KEY = "log4j.enable";
-
+ Special level value signifying inherited behaviour. The current
+ value of this string constant is <b>inherited</b>. {@link #NULL}
+ is a synonym. */
+ public static final String INHERITED = "inherited";
/**
- Special level value signifying inherited behaviour. The
- current value of this string constant is <b>inherited</b>.
- */
- public static final String INHERITED = "inherited";
+ Special level signifying inherited behaviour, same as {@link
+ #INHERITED}. The current value of this string constant is
+ <b>null</b>. */
+ public static final String NULL = "null";
1.32 +73 -37 jakarta-log4j/src/java/org/apache/log4j/spi/LoggingEvent.java
Index: LoggingEvent.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/spi/LoggingEvent.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- LoggingEvent.java 9 May 2002 17:44:54 -0000 1.31
+++ LoggingEvent.java 9 Oct 2002 22:50:06 -0000 1.32
@@ -10,7 +10,7 @@
import org.apache.log4j.*;
import org.apache.log4j.helpers.LogLog;
-
+import org.apache.log4j.helpers.Loader;
import java.lang.reflect.Method;
import java.io.ObjectOutputStream;
import java.io.ObjectInputStream;
@@ -39,19 +39,40 @@
/** Fully qualified name of the calling category class. */
transient public final String fqnOfCategoryClass;
- /** The category of the logging event. The category field is not
- serialized for performance reasons.
-
- <p>It is set by the LoggingEvent constructor or set by a remote
- entity after deserialization. */
- transient public Category logger;
-
- /** The category (logger) name. */
- public final String categoryName;
-
- /** Level of logging event. Level cannot be serializable
- because it is a flyweight. Due to its special seralization it
- cannot be declared final either. */
+ /**
+ * The category of the logging event. This field is not serialized
+ * for performance reasons.
+ *
+ * <p>It is set by the LoggingEvent constructor or set by a remote
+ * entity after deserialization.
+ *
+ * @deprecated This field will be marked as private or be completely
+ * removed in future releases. Please do not use it.
+ * */
+ transient private Category logger;
+
+ /**
+ * <p>The category (logger) name.
+ *
+ * @deprecated This field will be marked as private in future
+ * releases. Please do not access it directly. Use the {@link
+ * #getLoggerName} method instead.
+
+ * */
+ final public String categoryName;
+
+ /**
+ * Level of logging event. Level cannot be serializable because it
+ * is a flyweight. Due to its special seralization it cannot be
+ * declared final either.
+ *
+ * <p> This field should not be accessed directly. You shoud use the
+ * {@link #getLevel} method instead.
+ *
+ * @deprecated This field will be marked as private in future
+ * releases. Please do not access it directly. Use the {@link
+ * #getLevel} method instead.
+ * */
transient public Priority level;
/** The nested diagnostic context (NDC) of logging event. */
@@ -62,18 +83,16 @@
/** Have we tried to do an NDC lookup? If we did, there is no need
- to do it again. Note that its value is always false when
- serialized. Thus, a receiving SocketNode will never use it's own
- (incorrect) NDC. See also writeObject method. */
+ * to do it again. Note that its value is always false when
+ * serialized. Thus, a receiving SocketNode will never use it's own
+ * (incorrect) NDC. See also writeObject method. */
private boolean ndcLookupRequired = true;
- /** Have we tried to do an MDC lookup? If we did, there is no need to
- do it again. Note that its value is always false when
- serialized. Thus, a receiving SocketNode will never use it's own
- (incorrect) MDC. See also writeObject method. */
- private boolean mdcLookupRequired = true;
-
+ /** Have we tried to do an MDC lookup? If we did, there is no need
+ * to do it again. Note that its value is always false when
+ * serialized. See also the getMDC and getMDCCopy methods. */
+ private boolean mdcCopyLookupRequired = true;
/** The application supplied message of logging event. */
transient private Object message;
@@ -154,20 +173,31 @@
this.timeStamp = timeStamp;
}
-
-
/**
Set the location information for this logging event. The collected
information is cached for future use.
*/
- public
- LocationInfo getLocationInformation() {
+ public LocationInfo getLocationInformation() {
if(locationInfo == null) {
locationInfo = new LocationInfo(new Throwable(), fqnOfCategoryClass);
}
return locationInfo;
}
+ /**
+ * Return the level of this event. Use this form instead of directly
+ * accessing the <code>level</code> field. */
+ public Level getLevel() {
+ return (Level) level;
+ }
+
+ /**
+ * Return the name of the logger. Use this form instead of directly
+ * accessing the <code>categoryName</code> field.
+ */
+ public String getLoggerName() {
+ return categoryName;
+ }
/**
Return the message for this logging event.
@@ -187,6 +217,11 @@
}
}
+ /**
+ * This method returns the NDC for this event. It will return the
+ * correct content even if the event was generated in a different
+ * thread or even on a different machine. The {@link NDC#get} method
+ * should <em>never</em> be called directly. */
public
String getNDC() {
if(ndcLookupRequired) {
@@ -199,9 +234,11 @@
/**
Returns the the context corresponding to the <code>key</code>
- parameter. If there is a local MDC copy (probably from a remote
- machine, the we use it, if that fails then the current thread's
- <code>MDC</code> is used.
+ parameter. If there is a local MDC copy, possibly because we are
+ in a logging server or running inside AsyncAppender, then we
+ search for the key in MDC copy, if a value is found it is
+ returned. Otherwise, if the search in MDC copy returns a null
+ result, then the current thread's <code>MDC</code> is used.
<p>Note that <em>both</em> the local MDC copy and the current
thread's MDC are searched.
@@ -223,11 +260,12 @@
/**
Obtain a copy of this thread's MDC prior to serialization or
- asynchronous logging. */
+ asynchronous logging.
+ */
public
void getMDCCopy() {
- if(mdcLookupRequired) {
- ndcLookupRequired = false;
+ if(mdcCopyLookupRequired) {
+ mdcCopyLookupRequired = false;
// the clone call is required for asynchronous logging.
// See also bug #5932.
Hashtable t = (Hashtable) MDC.getContext();
@@ -259,9 +297,7 @@
/**
Returns the time when the application started, in milliseconds
elapsed since 01.01.1970. */
- public
- static
- long getStartTime() {
+ public static long getStartTime() {
return startTime;
}
@@ -310,7 +346,7 @@
} else {
Method m = (Method) methodCache.get(className);
if(m == null) {
- Class clazz = Class.forName(className);
+ Class clazz = Loader.loadClass(className);
// Note that we use Class.getDeclaredMethod instead of
// Class.getMethod. This assumes that the Level subclass
// implements the toLevel(int) method which is a
1.4 +0 -3 jakarta-log4j/src/java/org/apache/log4j/spi/RepositorySelector.java
Index: RepositorySelector.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/spi/RepositorySelector.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RepositorySelector.java 24 Apr 2002 01:16:11 -0000 1.3
+++ RepositorySelector.java 9 Oct 2002 22:50:06 -0000 1.4
@@ -1,6 +1,3 @@
-
-
-
package org.apache.log4j.spi;
1.9 +51 -31 jakarta-log4j/src/java/org/apache/log4j/spi/ThrowableInformation.java
Index: ThrowableInformation.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/spi/ThrowableInformation.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ThrowableInformation.java 26 Mar 2002 22:22:58 -0000 1.8
+++ ThrowableInformation.java 9 Oct 2002 22:50:06 -0000 1.9
@@ -12,10 +12,18 @@
import java.util.Vector;
/**
-
-
-
- */
+ * ThrowableInformation is log4j's internal representation of
+ * throwables. It essentially consists of a string array, called
+ * 'rep', where the first element, that is rep[0], represents the
+ * string representation of the throwable (i.e. the value you get
+ * when you do throwable.toString()) and subsequent elements
+ * correspond the stack trace with the top most entry of the stack
+ * corresponding to the second entry of the 'rep' array that is
+ * rep[1].
+ *
+ * @author Ceki Gülcü
+ *
+ * */
public class ThrowableInformation implements java.io.Serializable {
static final long serialVersionUID = -4748765566864322735L;
@@ -41,12 +49,20 @@
VectorWriter vw = new VectorWriter();
throwable.printStackTrace(vw);
rep = vw.toStringArray();
- vw.clear();
return rep;
}
}
}
+/**
+ * VectorWriter is a seemingly trivial implemtantion of PrintWriter.
+ * The throwable instance that we are trying to represnt is asked to
+ * print itself to a VectorWriter.
+ *
+ * By our design choice, r string representation of the throwable
+ * does not contain any line separators. It follows that println()
+ * methods of VectorWriter ignore the 'ln' part.
+ * */
class VectorWriter extends PrintWriter {
private Vector v;
@@ -56,34 +72,27 @@
v = new Vector();
}
- // Support for Orion
- public
- void print(Object o) {
+ public void print(Object o) {
v.addElement(o.toString());
}
- // Support for Orion
- public
- void print(char[] s) {
- v.addElement(new String(s));
+ public void print(char[] chars) {
+ v.addElement(new String(chars));
}
- // Support for Orion
- public
- void print(String s) {
+ public void print(String s) {
v.addElement(s);
}
- public
- void println(Object o) {
+ public void println(Object o) {
v.addElement(o.toString());
}
// JDK 1.1.x apprenly uses this form of println while in
// printStackTrace()
public
- void println(char[] s) {
- v.addElement(new String(s));
+ void println(char[] chars) {
+ v.addElement(new String(chars));
}
public
@@ -91,8 +100,23 @@
v.addElement(s);
}
- public
- String[] toStringArray() {
+ public void write(char[] chars) {
+ v.addElement(new String(chars));
+ }
+
+ public void write(char[] chars, int off, int len) {
+ v.addElement(new String(chars, off, len));
+ }
+
+ public void write(String s, int off, int len) {
+ v.addElement(s.substring(off, off+len));
+ }
+
+ public void write(String s) {
+ v.addElement(s);
+ }
+
+ public String[] toStringArray() {
int len = v.size();
String[] sa = new String[len];
for(int i = 0; i < len; i++) {
@@ -101,24 +125,20 @@
return sa;
}
- public
- void clear() {
- v.setSize(0);
- }
}
class NullWriter extends Writer {
- public
- void close() {
+ public void close() {
+ // blank
}
- public
- void flush() {
+ public void flush() {
+ // blank
}
- public
- void write(char[] cbuf, int off, int len) {
+ public void write(char[] cbuf, int off, int len) {
+ // blank
}
}
1.2 +3 -4 jakarta-log4j/src/java/org/apache/log4j/test/AsyncAppenderTest.java
Index: AsyncAppenderTest.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/test/AsyncAppenderTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AsyncAppenderTest.java 17 Jan 2001 13:02:26 -0000 1.1
+++ AsyncAppenderTest.java 9 Oct 2002 22:50:06 -0000 1.2
@@ -1,9 +1,8 @@
/* Copyright (C) The Apache Software Foundation. All rights reserved.
*
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.APL file.
- */
+ * This software is published under the terms of the Apache Software
+ * License version 1.1, a copy of which has been included with this
+ * distribution in the LICENSE.txt file. */
package org.apache.log4j.test;
1.5 +1 -1 jakarta-log4j/src/java/org/apache/log4j/test/ConfigurationFileParsing.java
Index: ConfigurationFileParsing.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/test/ConfigurationFileParsing.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ConfigurationFileParsing.java 13 Feb 2001 17:37:29 -0000 1.4
+++ ConfigurationFileParsing.java 9 Oct 2002 22:50:06 -0000 1.5
@@ -3,7 +3,7 @@
*
* This software is published under the terms of the Apache Software
* License version 1.1, a copy of which has been included with this
- * distribution in the LICENSE.APL file. */
+ * distribution in the LICENSE.txt file. */
package org.apache.log4j.test;
1.6 +16 -13 jakarta-log4j/src/java/org/apache/log4j/varia/FallbackErrorHandler.java
Index: FallbackErrorHandler.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/varia/FallbackErrorHandler.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- FallbackErrorHandler.java 9 May 2002 15:43:44 -0000 1.5
+++ FallbackErrorHandler.java 9 Oct 2002 22:50:06 -0000 1.6
@@ -16,16 +16,17 @@
import java.util.Vector;
/**
-
- The <code>FallbackErrorHandler</code> implements the ErrorHandler
- interface such that a secondary appender may be specified. This
- secondary appender takes over if the primary appender fails for
- whatever reason.
-
- <p>The error message is printed on <code>System.err</code>, and
- logged in the new secondary appender.
-
-*/
+ *
+ * The <code>FallbackErrorHandler</code> implements the ErrorHandler
+ * interface such that a secondary appender may be specified. This
+ * secondary appender takes over if the primary appender fails for
+ * whatever reason.
+ *
+ * <p>The error message is printed on <code>System.err</code>, and
+ * logged in the new secondary appender.
+ *
+ * @author Ceki Gücü
+ * */
public class FallbackErrorHandler implements ErrorHandler {
@@ -73,13 +74,15 @@
*/
public
void error(String message, Exception e, int errorCode, LoggingEvent event) {
+ LogLog.debug("FB: The following error reported: " + message, e);
+ LogLog.debug("FB: INITIATING FALLBACK PROCEDURE.");
for(int i = 0; i < loggers.size(); i++) {
Logger l = (Logger) loggers.elementAt(i);
- LogLog.debug("FB: Searching for ["+primary.getName()+"] in logger"
- +l.getName());
+ LogLog.debug("FB: Searching for ["+primary.getName()+"] in logger ["
+ +l.getName() + "].");
//if(l.isAttached(primary)) {
LogLog.debug("FB: Replacing ["+primary.getName()+"] by ["
- + backup.getName() + " in logger"+ l);
+ + backup.getName() + "] in logger ["+ l.getName() +"].");
l.removeAppender(primary);
LogLog.debug("FB: Adding appender ["+backup.getName()+"] to logger "
+ l.getName());
1.7 +1 -1 jakarta-log4j/src/java/org/apache/log4j/varia/LevelMatchFilter.java
Index: LevelMatchFilter.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/varia/LevelMatchFilter.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- LevelMatchFilter.java 20 May 2002 09:52:58 -0000 1.6
+++ LevelMatchFilter.java 9 Oct 2002 22:50:06 -0000 1.7
@@ -78,7 +78,7 @@
}
boolean matchOccured = false;
- if(this.levelToMatch.equals(event.level)) {
+ if(this.levelToMatch.equals(event.getLevel())) {
matchOccured = true;
}
1.3 +2 -41 jakarta-log4j/src/java/org/apache/log4j/varia/LevelRangeFilter.java
Index: LevelRangeFilter.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/varia/LevelRangeFilter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LevelRangeFilter.java 20 May 2002 09:52:58 -0000 1.2
+++ LevelRangeFilter.java 9 Oct 2002 22:50:06 -0000 1.3
@@ -59,14 +59,14 @@
public
int decide(LoggingEvent event) {
if(this.levelMin != null) {
- if (event.level.isGreaterOrEqual(levelMin) == false) {
+ if (event.getLevel().isGreaterOrEqual(levelMin) == false) {
// level of event is less than minimum
return Filter.DENY;
}
}
if(this.levelMax != null) {
- if (event.level.toInt() > levelMax.toInt()) {
+ if (event.getLevel().toInt() > levelMax.toInt()) {
// level of event is greater than maximum
// Alas, there is no Level.isGreater method. and using
// a combo of isGreaterOrEqual && !Equal seems worse than
@@ -132,44 +132,5 @@
void setAcceptOnMatch(boolean acceptOnMatch) {
this.acceptOnMatch = acceptOnMatch;
}
-
-
- /**
- @deprecated We now use JavaBeans introspection to configure
- components.
- */
- public
- String[] getOptionStrings() {
- return new String[] {
- LEVEL_MIN_OPTION,
- LEVEL_MAX_OPTION,
- ACCEPT_ON_MATCH_OPTION};
- }
-
- /**
- @deprecated We now use JavaBeans introspection to configure
- components.
- */
- public
- void setOption(String key, String value) {
- if(key.equalsIgnoreCase(LEVEL_MIN_OPTION)) {
- levelMin = OptionConverter.toLevel(value, null);
- }
- else if (key.equalsIgnoreCase(LEVEL_MAX_OPTION)) {
- levelMax = OptionConverter.toLevel(value, null);
- }
- else if (key.equalsIgnoreCase(ACCEPT_ON_MATCH_OPTION)) {
- acceptOnMatch = OptionConverter.toBoolean(value, acceptOnMatch);
- }
- }
-
- /** See class comments */
- public static final String LEVEL_MIN_OPTION = "LevelMin";
-
- /** See class comments */
- public static final String LEVEL_MAX_OPTION = "LevelMax";
-
- /** See class comments */
- public static final String ACCEPT_ON_MATCH_OPTION = "AcceptOnMatch";
}
1.2 +65 -0 jakarta-log4j/src/java/org/apache/log4j/varia/NullAppender.java
1.50 +7 -7 jakarta-log4j/src/java/org/apache/log4j/xml/DOMConfigurator.java
Index: DOMConfigurator.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/xml/DOMConfigurator.java,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- DOMConfigurator.java 4 Apr 2002 19:22:19 -0000 1.49
+++ DOMConfigurator.java 9 Oct 2002 22:50:06 -0000 1.50
@@ -161,7 +161,7 @@
String className = subst(appenderElement.getAttribute(CLASS_ATTR));
LogLog.debug("Class name: [" + className+']');
try {
- Object instance = Class.forName(className).newInstance();
+ Object instance = Loader.loadClass(className).newInstance();
Appender appender = (Appender)instance;
PropertySetter propSetter = new PropertySetter(appender);
@@ -311,7 +311,7 @@
else {
LogLog.debug("Desired logger sub-class: ["+className+']');
try {
- Class clazz = Class.forName(className);
+ Class clazz = Loader.loadClass(className);
Method getInstanceMethod = clazz.getMethod("getLogger",
ONE_STRING_PARAM);
cat = (Logger) getInstanceMethod.invoke(null, new Object[] {catName});
@@ -442,7 +442,7 @@
String className = subst(layout_element.getAttribute(CLASS_ATTR));
LogLog.debug("Parsing layout of class: \""+className+"\"");
try {
- Object instance = Class.forName(className).newInstance();
+ Object instance = Loader.loadClass(className).newInstance();
Layout layout = (Layout)instance;
PropertySetter propSetter = new PropertySetter(layout);
@@ -493,7 +493,7 @@
String priStr = subst(element.getAttribute(VALUE_ATTR));
LogLog.debug("Level value for "+catName+" is ["+priStr+"].");
- if(INHERITED.equals(priStr)) {
+ if(INHERITED.equalsIgnoreCase(priStr) || NULL.equalsIgnoreCase(priStr)) {
if(isRoot) {
LogLog.error("Root level cannot be inherited. Ignoring directive.");
} else {
@@ -506,7 +506,7 @@
} else {
LogLog.debug("Desired Level sub-class: ["+className+']');
try {
- Class clazz = Class.forName(className);
+ Class clazz = Loader.loadClass(className);
Method toLevelMethod = clazz.getMethod("toLevel",
ONE_STRING_PARAM);
Level pri = (Level) toLevelMethod.invoke(null,
@@ -733,9 +733,9 @@
// "debug" attribute is returned as the empty string.
if(!debugAttrib.equals("") && !debugAttrib.equals("null")) {
LogLog.setInternalDebugging(OptionConverter.toBoolean(debugAttrib, true));
- }
- else
+ } else {
LogLog.debug("Ignoring " + INTERNAL_DEBUG_ATTR + " attribute.");
+ }
String confDebug = subst(element.getAttribute(CONFIG_DEBUG_ATTR));
1.19 +89 -91 jakarta-log4j/src/java/org/apache/log4j/xml/XMLLayout.java
Index: XMLLayout.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/xml/XMLLayout.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- XMLLayout.java 26 Apr 2002 16:11:42 -0000 1.18
+++ XMLLayout.java 9 Oct 2002 22:50:06 -0000 1.19
@@ -17,37 +17,38 @@
import org.apache.log4j.helpers.Transform;
/**
- The output of the XMLLayout consists of a series of log4j:event
- elements as defined in the <a
- href="doc-files/log4j.dtd">log4j.dtd</a>. It does not output a
- complete well-formed XML file. The output is designed to be
- included as an <em>external entity</em> in a separate file to form
- a correct XML file.
-
- <p>For example, if <code>abc</code> is the name of the file where
- the XMLLayout ouput goes, then a well-formed XML file would be:
-
- <pre>
+ * The output of the XMLLayout consists of a series of log4j:event
+ * elements as defined in the <a
+ * href="doc-files/log4j.dtd">log4j.dtd</a>. It does not output a
+ * complete well-formed XML file. The output is designed to be
+ * included as an <em>external entity</em> in a separate file to form
+ * a correct XML file.
+ *
+ * <p>For example, if <code>abc</code> is the name of the file where
+ * the XMLLayout ouput goes, then a well-formed XML file would be:
+ *
+ <pre>
<?xml version="1.0" ?>
-
- <!DOCTYPE log4j:eventSet SYSTEM "log4j.dtd" [<!ENTITY data SYSTEM "abc">]>
-
- <log4j:eventSet version="1.2" xmlns:log4j="http://jakarta.apache.org/log4j/">
- &data;
- </log4j:eventSet>
- </pre>
-
- <p>This approach enforces the independence of the XMLLayout and the
- appender where it is embedded.
-
- <p>The <code>version</code> attribute helps components to correctly
- intrepret output generated by XMLLayout. The value of this
- attribute should be "1.1" for output generated by log4j versions
- prior to log4j 1.2 (final release) and "1.2" for relase 1.2 and
- later.
-
- @author Ceki Gülcü
- @since 0.9.0 */
+
+ <!DOCTYPE log4j:eventSet SYSTEM "log4j.dtd" [<!ENTITY data SYSTEM "abc">]>
+
+ <log4j:eventSet version="1.2" xmlns:log4j="http://jakarta.apache.org/log4j/">
+ &data;
+ </log4j:eventSet>
+ </pre>
+
+ * <p>This approach enforces the independence of the XMLLayout and the
+ * appender where it is embedded.
+ *
+ * <p>The <code>version</code> attribute helps components to correctly
+ * intrepret output generated by XMLLayout. The value of this
+ * attribute should be "1.1" for output generated by log4j versions
+ * prior to log4j 1.2 (final release) and "1.2" for relase 1.2 and
+ * later.
+ *
+ * @author Ceki Gülcü
+ * @since 0.9.0
+ * */
public class XMLLayout extends Layout {
private final int DEFAULT_SIZE = 256;
@@ -55,41 +56,38 @@
private StringBuffer buf = new StringBuffer(DEFAULT_SIZE);
private boolean locationInfo = false;
-
/**
- The <b>LocationInfo</b> option takes a boolean value. By
- default, it is set to false which means there will be no location
- information output by this layout. If the the option is set to
- true, then the file name and line number of the statement
- at the origin of the log statement will be output.
-
- <p>If you are embedding this layout within an {@link
- org.apache.log4j.net.SMTPAppender} then make sure to set the
- <b>LocationInfo</b> option of that appender as well.
- */
- public
- void setLocationInfo(boolean flag) {
+ * The <b>LocationInfo</b> option takes a boolean value. By default,
+ * it is set to false which means there will be no location
+ * information output by this layout. If the the option is set to
+ * true, then the file name and line number of the statement at the
+ * origin of the log statement will be output.
+ *
+ * <p>If you are embedding this layout within an {@link
+ * org.apache.log4j.net.SMTPAppender} then make sure to set the
+ * <b>LocationInfo</b> option of that appender as well.
+ * */
+ public void setLocationInfo(boolean flag) {
locationInfo = flag;
}
/**
Returns the current value of the <b>LocationInfo</b> option.
*/
- public
- boolean getLocationInfo() {
+ public boolean getLocationInfo() {
return locationInfo;
}
- public
- void activateOptions() {
+ /** No options to activate. */
+ public void activateOptions() {
}
/**
- Formats a {@link LoggingEvent} in conformance with the log4j.dtd. */
- public
- String format(LoggingEvent event) {
+ * Formats a {@link LoggingEvent} in conformance with the log4j.dtd.
+ * */
+ public String format(LoggingEvent event) {
// Reset working buffer. If the buffer is too large, then we need a new
// one in order to avoid the penalty of creating a large array.
@@ -101,53 +99,54 @@
// We yield to the \r\n heresy.
- buf.append("<log4j:event category=\"");
- buf.append(event.categoryName);
+ buf.append("<log4j:event logger=\"");
+ buf.append(event.getLoggerName());
buf.append("\" timestamp=\"");
buf.append(event.timeStamp);
buf.append("\" level=\"");
- buf.append(event.level);
+ buf.append(event.getLevel());
buf.append("\" thread=\"");
buf.append(event.getThreadName());
buf.append("\">\r\n");
-
- buf.append("<log4j:message><![CDATA[");
- buf.append(event.getRenderedMessage());
- buf.append("]]></log4j:message>\r\n");
-
- String ndc = event.getNDC();
- if(ndc != null) {
- buf.append("<log4j:NDC><![CDATA[");
- buf.append(ndc);
- buf.append("]]></log4j:NDC>\r\n");
- }
-
- String[] s = event.getThrowableStrRep();
- if(s != null) {
- buf.append("<log4j:throwable><![CDATA[");
- for(int i = 0; i < s.length; i++) {
- buf.append(s[i]);
- buf.append("\r\n");
- }
- buf.append("]]></log4j:throwable>\r\n");
- }
-
- if(locationInfo) {
- LocationInfo locationInfo = event.getLocationInformation();
- buf.append("<log4j:locationInfo class=\"");
- buf.append(locationInfo.getClassName());
- buf.append("\" method=\"");
- buf.append(Transform.escapeTags(locationInfo.getMethodName()));
- buf.append("\" file=\"");
- buf.append(locationInfo.getFileName());
- buf.append("\" line=\"");
- buf.append(locationInfo.getLineNumber());
- buf.append("\"/>\r\n");
- }
-
+ buf.append("<log4j:message><![CDATA[");
+ // Append the rendered message. Also make sure to escape any
+ // existing CDATA sections.
+ Transform.appendEscapingCDATA(buf, event.getRenderedMessage());
+ buf.append("]]></log4j:message>\r\n");
+
+ String ndc = event.getNDC();
+ if(ndc != null) {
+ buf.append("<log4j:NDC><![CDATA[");
+ buf.append(ndc);
+ buf.append("]]></log4j:NDC>\r\n");
+ }
+
+ String[] s = event.getThrowableStrRep();
+ if(s != null) {
+ buf.append("<log4j:throwable><![CDATA[");
+ for(int i = 0; i < s.length; i++) {
+ buf.append(s[i]);
+ buf.append("\r\n");
+ }
+ buf.append("]]></log4j:throwable>\r\n");
+ }
+
+ if(locationInfo) {
+ LocationInfo locationInfo = event.getLocationInformation();
+ buf.append("<log4j:locationInfo class=\"");
+ buf.append(locationInfo.getClassName());
+ buf.append("\" method=\"");
+ buf.append(Transform.escapeTags(locationInfo.getMethodName()));
+ buf.append("\" file=\"");
+ buf.append(locationInfo.getFileName());
+ buf.append("\" line=\"");
+ buf.append(locationInfo.getLineNumber());
+ buf.append("\"/>\r\n");
+ }
+
buf.append("</log4j:event>\r\n\r\n");
-
+
return buf.toString();
}
@@ -155,8 +154,7 @@
The XMLLayout prints and does not ignore exceptions. Hence the
return value <code>false</code>.
*/
- public
- boolean ignoresThrowable() {
+ public boolean ignoresThrowable() {
return false;
}
}
1.19 +10 -7 jakarta-log4j/src/java/org/apache/log4j/xml/log4j.dtd
Index: log4j.dtd
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/xml/log4j.dtd,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- log4j.dtd 9 May 2002 15:43:44 -0000 1.18
+++ log4j.dtd 9 Oct 2002 22:50:06 -0000 1.19
@@ -15,12 +15,15 @@
<!-- logging statements with a level equal or below this value are -->
<!-- disabled. -->
-<!-- Setting the "debug" or "configDebug" attributes enable the printing -->
-<!-- of internal log4j logging statements. -->
-
-<!-- By default, debug attribute is "null", meaning that we not touch -->
-<!-- internal log4j logging settings. -->
+<!-- Setting the "debug" enable the printing of internal log4j logging -->
+<!-- statements. -->
+<!-- By default, debug attribute is "null", meaning that we not do touch -->
+<!-- internal log4j logging settings. The "null" value for the threshold -->
+<!-- attribute can be misleading. The threshold field of a repository -->
+<!-- cannot be set to null. The "null" value for the threshold attribute -->
+<!-- simply means don't touch the threshold field, the threshold field -->
+<!-- keeps its old value. -->
<!ATTLIST log4j:configuration
xmlns:log4j CDATA #FIXED "http://jakarta.apache.org/log4j/"
@@ -143,8 +146,8 @@
<!-- The timestamp format is application dependent. -->
<!ATTLIST log4j:event
- category CDATA #REQUIRED
- priority CDATA #REQUIRED
+ logger CDATA #REQUIRED
+ level CDATA #REQUIRED
thread CDATA #REQUIRED
timestamp CDATA #REQUIRED
>
1.8 +8 -4 jakarta-log4j/src/xdocs/contributors.xml
Index: contributors.xml
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/xdocs/contributors.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- contributors.xml 2 Apr 2002 09:07:35 -0000 1.7
+++ contributors.xml 9 Oct 2002 22:50:06 -0000 1.8
@@ -8,7 +8,7 @@
<body>
<section name="Log4j contributors">
-
+
<p>Log4j is the result of contributions from several dozen
developers and hundreds of users across the globe. Some of the
more prominent contributors are listed below in alphabetical
@@ -64,9 +64,13 @@
</li>
<li><b>Jon Skeet</b>
-
- <p>Jon acts as a moderator for the log4j mailing lists where
- he is one of the most active participants.
+
+ <p>Jon is a software developer in his mid-twenties living in
+ the UK. He is a Java enthusiast and very active participant
+ in the comp.lang.java.* newsgroups as well as a moderator
+ for the log4j mailing lists. He is a committer for the Ant
+ project, involved (when time permits!) in tidying up the
+ code documentation.
</p>
</li>
1.16 +38 -9 jakarta-log4j/src/xdocs/documentation.xml
Index: documentation.xml
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/xdocs/documentation.xml,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- documentation.xml 24 Mar 2002 23:37:11 -0000 1.15
+++ documentation.xml 9 Oct 2002 22:50:06 -0000 1.16
@@ -15,15 +15,27 @@
<ul>
<p>
+ <a href="http://www.flashline.com/components/view.jsp?prodid=4702&affiliateid=657173"><img align="right" src="images/coverSmall.png"></img></a>
<li><a href="manual.html"><b>short manual</b></a>,
</li>
</p>
+
+ <p>
+ <li><a href="http://www.flashline.com/components/view.jsp?prodid=4702&affiliateid=657173"><b>complete manual</b></a> (commercial),
+ </li>
+ </p>
<p>
<li>
<a href="api/index.html"><b>javadoc documentation</b></a>,
</li>
</p>
+
+ <p>
+ <li>
+ <a href="lf5/overview.html"><b>LogFactor5 documentation</b></a>,
+ </li>
+ </p>
<p>
<li>
@@ -50,21 +62,38 @@
<section name="Articles on log4j">
<ul>
- <li><a href="http://www.vipan.com/htdocs/log4jhelp.html">Don't Use System.out.println!
+ <p>
+ <li><a href="http://www.vipan.com/htdocs/log4jhelp.html">Don't Use System.out.println!
Use Log4j</a> by Vipan Singla
- </li>
+ </li>
+ </p>
+
+ <p><li><a href="http://www.onjava.com/pub/a/onjava/2002/08/07/log4j.html?page=1">
+ Build Flexible Logs With log4j</a> by Vikram Goyal
+ </li></p>
+
- <li><a href="http://builder.com.com/article.jhtml?id=u00820020124kev01.htm">
+ <p><li><a href="http://www.builder.com.com/article.jhtml?id=u00820020124kev01.htm">
Add logging to your Java Applications</a> by Kevin Brown
- </li>
+ </li></p>
- <li><a href="http://www.entwickler.com/jm/ausgaben/2001/4/artikel/17/online.shtml">
- Computer: captains, new entry... DasJakarta Logging-System log4j</a> by Thomas Poschmann
- </li>
+ <p><li><a href="http://www.builder.com.com/article.jhtml?id=u00220020724kev01.htm">
+ How does the Java logging API stack up against log4j?</a> by Kevin Brown
+ </li></p>
- <li>
+ <p><li>
<a href="http://www.opensymphony.com/guidelines/logging.jsp">OpenSymphony Logging Primer</a>
- </li>
+ </li></p>
+
+ <p><li>
+ <a href="http://www.jguru.com/faq/Log4j">log4j FAQ</a> at jGuru
+ </li></p>
+
+ <p><li>
+ <a href="http://qos.ch/logging/thinkAgain.html">Think Again</a> by Ceki Gülcü
+
+ </li></p>
+
</ul>
<p>If you would like your log4j-relateed article to be listed
1.54 +37 -14 jakarta-log4j/src/xdocs/download.xml
Index: download.xml
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/xdocs/download.xml,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- download.xml 9 May 2002 20:15:02 -0000 1.53
+++ download.xml 9 Oct 2002 22:50:07 -0000 1.54
@@ -9,13 +9,19 @@
<meta name="keywords" content="java, logging, tracing, component, framework, API, log4j"/>
<body>
- <section name="log4j version 1.2 (final)">
- <p>log4j 1.2 is now available in <a
- href="../jakarta-log4j-1.2.tar.gz"><b>TAR.GZ</b></a> format or
- in <a href="../jakarta-log4j-1.2.zip"><b>ZIP</b></a> format.
+ <section name="log4j version 1.2.7">
+ <p>log4j 1.2.7 is available in <a
+ href="../jakarta-log4j-1.2.7.tar.gz"><b>TAR.GZ</b></a> format
+ or in <a href="../jakarta-log4j-1.2.7.zip"><b>ZIP</b></a>
+ format.
</p>
-
+ <p>As of release 1.2.7 log4j now searches for the file log4j.xml
+ as well as the file log4j.properties during
+ initialization. See the <a href="HISTORY">HISTORY</a> file for
+ the firther details.
+ </p>
+
<p>In addition to many performance improvements, bug fixes, and
other small enhancements, log4j 1.2 adds JMX support, Mapped
Diagnostic Contexts, JDBC logging, graphical log viewer
@@ -35,14 +41,15 @@
replacement for log4j 1.1.3. The only exception is the
renaming of the <code>CategoryFactory</code> class to
<code>LoggerFactory</code> class such that subclasses of
- <code>Category</code> class to be modified and recompiled. By
- the way, we strongly discourage casual users from subclassing
- the <code>Category</code> or <code>Logger</code> classes.
+ <code>Category</code> class must be modified and
+ recompiled. By the way, <b>we strongly discourage casual users
+ from subclassing the <code>Category</code> or
+ <code>Logger</code> classes.</b>
</p>
<p>We also maintain a list of <a href="earlier.html">earlier
versions</a> of log4j for download, intended for the curious
- paleontologist.
+ paleontologist -- there seems to be thousands of them!
</p>
@@ -57,9 +64,9 @@
<dt><a
href="http://logui.sourceforge.net/"><b>Chainsaw</b></a></dt>
- <dd>Chainsaw is now integrated with log4j and ships with the
- official distribution. Chainsaw is a graphical log viewer and
- filter for the log4j package. It listens for <a
+ <dd><b>Chainsaw is now integrated with log4j and ships with
+ the official distribution.</b> Chainsaw is a graphical log
+ viewer and filter for the log4j package. It listens for <a
href="http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/spi/LoggingEvent.html">LoggingEvent</a>
objects sent using the <a
href="http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/net/SocketAppender.html">SocketAppender</a>
@@ -198,14 +205,24 @@
</dd>
<!-- =========================================================================== -->
-
+ <dt><a
+ href="http://log4perl.sourceforge.net"><b>Log::Log4perl</b></a></dt>
+
+ <dd>Log::Log4perl is a Perl port of log4j by Kevin Goess and
+ Mike Schilli. The authors made sure that their port was as
+ close as possible to the original implementation. Even the
+ configuration files are similar! The project is still being
+ enhanced, however the current release is stable and has been
+ released to CPAN.
+ </dd>
+ <!-- =========================================================================== -->
<dt><a
href="http://www.neoworks.com/products/log4net/"><b>log4net</b></a></dt>
<dd>The .NET implementation of the popular log4j Java API
providing flexible and arbitrarily granular control over log
management and configuration.</dd>
-
+
<!-- =========================================================================== -->
<dt><a
href="http://www.its4you.at/log4py.php"><b>log4py</b></a></dt>
@@ -233,7 +250,13 @@
</dd>
<!-- =========================================================================== -->
+
+ <dt><a href="http://sourceforge.net/projects/qmmslog"><b>qmmslog</b></a></dt>
+ <dd>Qmmslog is a port of log4j to the Qt/C++ platform.
+ </dd>
+
+ <!-- =========================================================================== -->
<dt><a
href="http://log4r.sourceforge.net"><b>log4r</b></a></dt>
<dd>A Powerful Logger for Ruby.
1.9 +7 -8 jakarta-log4j/src/xdocs/index.xml
Index: index.xml
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/xdocs/index.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- index.xml 6 Mar 2002 13:31:48 -0000 1.8
+++ index.xml 9 Oct 2002 22:50:07 -0000 1.9
@@ -53,14 +53,13 @@
remote log4j server, a remote Unix Syslog daemon, or even a NT
Event logger among many other output targets.</p>
- <p>On a 233 MHz ThinkPad running JDK 1.1.7B, it costs about 46
- nanoseconds to determine if that statement should be logged or
- not. Actual logging is also quite fast, ranging from 79
- microseconds using the SimpleLayout, 164 microseconds using
- the TTCCLayout and around a millisecond when printing
- exceptions. The performance of the PatternLayout is almost as
- good as the dedicated layouts, except that it is a lot more
- flexible.</p>
+ <p>On an AMD Duron clocked at 800Mhz running JDK 1.3.1, it costs
+ about 5 nanoseconds to determine if a logging statement should
+ be logged or not. Actual logging is also quite fast, ranging
+ from 21 microseconds microseconds using the SimpleLayout, 37
+ microseconds using the TTCCLayout. The performance of the
+ PatternLayout is almost as good as the dedicated layouts,
+ except that it is much more flexible.</p>
<p>The package is being constantly improved thanks to input from
users and code contributed by authors in the community.
1.8 +9 -10 jakarta-log4j/src/xdocs/plan.xml
Index: plan.xml
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/xdocs/plan.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- plan.xml 12 Apr 2002 10:01:11 -0000 1.7
+++ plan.xml 9 Oct 2002 22:50:07 -0000 1.8
@@ -3,7 +3,7 @@
<properties>
<author email="ceki@apache.org">Ceki Gulcu</author>
- <title>Release plan for log4j 1.2</title>
+ <title>Release plan for log4j 1.3</title>
</properties>
<body>
@@ -35,10 +35,13 @@
<section name="Workplan for log4j 1.3">
- <p>With log4j 1.2 still in beta, the workplan for log4j 1.3 is
- obviously not final. It is included here to give you an idea
- of the future. The items are not listed in any particular
- order.
+ <p>The workplan for log4j 1.3 is not final. It is included here
+ to give you an idea of the future. The items are not listed in
+ any particular order. As always, there is no scheduled
+ release date. The lack of schedule suprises and disturbs some
+ people. Writing good software, like good cooking, takes
+ time. If we make you wait, it is to create a better and more
+ reliable product.
</p>
<table border="1" cellpadding="3" cellspacing="2">
@@ -234,11 +237,7 @@
<section name="Workplan for log4j 1.2">
<p>
- Here is workplan for the 1.2 release. As always, there is no
- scheduled release date. The lack of schedule suprises and
- disturbs some people. Writing good software, like good
- cooking, takes time. If we make you wait, it is to create a
- better and more reliable product.
+ Here is workplan for the 1.2 release.
</p>
<table border="1" cellpadding="3" cellspacing="2">
1.2 +27 -0 jakarta-log4j/src/xdocs/stylesheets/lf5.xml
1.21 +80 -8 jakarta-log4j/tests/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-log4j/tests/build.xml,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- build.xml 16 Jun 2002 23:28:08 -0000 1.20
+++ build.xml 9 Oct 2002 22:50:07 -0000 1.21
@@ -51,9 +51,7 @@
build - compile all project files, if a certain library is missing,
then the compilation of its dependents are skipped.
- regression - Run regression ests which check large parts of log4j.
- unit - Run unit tests which check one component at a time.
- longUnit - Run long unit tests which check one component at a time.
+ regression - Run regression tests which check large parts of log4j.
runAll - run all available tests
</echo>
@@ -98,12 +96,12 @@
<!-- ================================================================= -->
<target name="regression" depends="Minimum, Logger, DOM, CustomLevel,
CustomLogger, PatternLayout,
- HierarchyThreshold, SocketServer,
- XMLLayout, AsyncAppender,
+ HierarchyThreshold, DefaultInit, SocketServer,
+ XMLLayout, AsyncAppender, ErrorHandler,
OptionConverter, BoundedFIFO,
CyclicBuffer, OR, VariaLevelMatchFilter,
- VariaLevelRangeFilter,
- FiltersLevelMatchFilter, DRFA"/>
+ VariaLevelRangeFilter, PatternParser,
+ LevelMatchFilter, FiltersLevelMatchFilter, DRFA"/>
<!-- ================================================================= -->
<!-- Longer unit tests -->
@@ -170,10 +168,60 @@
</junit>
</target>
+ <target name="DefaultInit" depends="build">
+ <!-- Delete possible cruft from previous runs. -->
+ <delete file="classes/log4j.xml"/>
+ <delete file="classes/log4j.properties"/>
+
+ <junit printsummary="yes" fork="yes" haltonfailure="yes">
+ <classpath refid="tests.classpath"/>
+ <formatter type="plain" usefile="false"/>
+ <test fork="true" name="org.apache.log4j.defaultInit.TestCase1" />
+ </junit>
+
+ <copy file="input/xml/defaultInit.xml" tofile="classes/log4j.xml"/>
+ <junit printsummary="yes" fork="yes" haltonfailure="yes">
+ <classpath refid="tests.classpath"/>
+ <formatter type="plain" usefile="false"/>
+ <test fork="true" name="org.apache.log4j.defaultInit.TestCase2" />
+ </junit>
+ <delete file="classes/log4j.xml"/>
+
+ <!-- test handling of log4j.defaultInitOverride system property -->
+ <copy file="input/xml/defaultInit.xml" tofile="classes/log4j.xml"/>
+ <junit printsummary="yes" fork="yes" haltonfailure="yes">
+ <jvmarg value="-Dlog4j.defaultInitOverride=true"/>
+ <classpath refid="tests.classpath"/>
+ <formatter type="plain" usefile="false"/>
+ <test fork="true" name="org.apache.log4j.defaultInit.TestCase1" />
+ </junit>
+ <delete file="classes/log4j.xml"/>
+
+ <!-- test default initialization from log4j.xml -->
+ <copy file="input/defaultInit3.properties" tofile="classes/log4j.properties"/>
+ <junit printsummary="yes" fork="yes" haltonfailure="yes">
+ <classpath refid="tests.classpath"/>
+ <formatter type="plain" usefile="false"/>
+ <test fork="true" name="org.apache.log4j.defaultInit.TestCase3" />
+ </junit>
+ <delete file="classes/log4j.properties"/>
+
+ <!-- test default initialization from log4j.properties -->
+ <copy file="input/xml/defaultInit.xml" tofile="classes/log4j.xml"/>
+ <copy file="input/defaultInit3.properties" tofile="classes/log4j.properties"/>
+ <junit printsummary="yes" fork="yes" haltonfailure="yes">
+ <classpath refid="tests.classpath"/>
+ <formatter type="plain" usefile="false"/>
+ <test fork="true" name="org.apache.log4j.defaultInit.TestCase4" />
+ </junit>
+ <delete file="classes/log4j.xml"/>
+ <delete file="classes/log4j.properties"/>
+ </target>
+
<target name="SocketServer" depends="build">
<parallel>
<java classname="org.apache.log4j.net.ShortSocketServer" fork="yes">
- <arg value="4"/>
+ <arg value="8"/>
<arg value="input/socketServer"/>
<classpath refid="tests.classpath"/>
</java>
@@ -229,6 +277,22 @@
</junit>
</target>
+ <target name="LevelMatchFilter" depends="build">
+ <junit printsummary="yes" fork="yes" haltonfailure="yes">
+ <classpath refid="tests.classpath"/>
+ <formatter type="plain" usefile="false"/>
+ <test name="org.apache.log4j.varia.LevelMatchFilterTestCase" />
+ </junit>
+ </target>
+
+ <target name="ErrorHandler" depends="build">
+ <junit printsummary="yes" fork="yes" haltonfailure="yes">
+ <classpath refid="tests.classpath"/>
+ <formatter type="plain" usefile="false" />
+ <test name="org.apache.log4j.varia.ErrorHandlerTestCase" />
+ </junit>
+ </target>
+
<target name="OptionConverter" depends="build">
<junit printsummary="yes" fork="yes" haltonfailure="yes">
<classpath refid="tests.classpath"/>
@@ -250,6 +314,14 @@
<classpath refid="tests.classpath"/>
<formatter type="plain" usefile="false"/>
<test name="org.apache.log4j.helpers.CyclicBufferTestCase" />
+ </junit>
+ </target>
+
+ <target name="PatternParser" depends="build">
+ <junit printsummary="yes" fork="yes" haltonfailure="yes">
+ <classpath refid="tests.classpath"/>
+ <formatter type="plain" usefile="false"/>
+ <test name="org.apache.log4j.helpers.PatternParserTestCase" />
</junit>
</target>
1.2 +7 -0 jakarta-log4j/tests/input/defaultInit3.properties
1.2 +8 -0 jakarta-log4j/tests/input/socketServer5.properties
1.2 +8 -0 jakarta-log4j/tests/input/socketServer6.properties
1.2 +8 -0 jakarta-log4j/tests/input/socketServer7.properties
1.2 +8 -0 jakarta-log4j/tests/input/socketServer8.properties
1.2 +17 -0 jakarta-log4j/tests/input/xml/defaultInit.xml
1.2 +35 -0 jakarta-log4j/tests/input/xml/fallback1.xml
1.2 +51 -1 jakarta-log4j/tests/src/java/org/apache/log4j/AsyncAppenderTestCase.java
Index: AsyncAppenderTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/tests/src/java/org/apache/log4j/AsyncAppenderTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AsyncAppenderTestCase.java 9 May 2002 17:44:54 -0000 1.1
+++ AsyncAppenderTestCase.java 9 Oct 2002 22:50:07 -0000 1.2
@@ -28,14 +28,17 @@
public void setUp() {
}
- public void tearDown() {
+ public void tearDown() {
+ LogManager.shutdown();
}
+ // this test checks whether it is possible to write to a closed AsyncAppender
public void closeTest() throws Exception {
Logger root = Logger.getRootLogger();
Layout layout = new SimpleLayout();
VectorAppender vectorAppender = new VectorAppender();
AsyncAppender asyncAppender = new AsyncAppender();
+ asyncAppender.setName("async-CloseTest");
asyncAppender.addAppender(vectorAppender);
root.addAppender(asyncAppender);
@@ -45,13 +48,60 @@
Vector v = vectorAppender.getVector();
assertEquals(v.size(), 1);
+ }
+
+ // this test checks whether appenders embedded within an AsyncAppender are also
+ // closed
+ public void test2() {
+ Logger root = Logger.getRootLogger();
+ Layout layout = new SimpleLayout();
+ VectorAppender vectorAppender = new VectorAppender();
+ AsyncAppender asyncAppender = new AsyncAppender();
+ asyncAppender.setName("async-test2");
+ asyncAppender.addAppender(vectorAppender);
+ root.addAppender(asyncAppender);
+
+ root.debug("m1");
+ asyncAppender.close();
+ root.debug("m2");
+ Vector v = vectorAppender.getVector();
+ assertEquals(v.size(), 1);
+ assertTrue(vectorAppender.isClosed());
+ }
+
+ // this test checks whether appenders embedded within an AsyncAppender are also
+ // closed
+ public void test3() {
+ int LEN = 200;
+ Logger root = Logger.getRootLogger();
+ Layout layout = new SimpleLayout();
+ VectorAppender vectorAppender = new VectorAppender();
+ AsyncAppender asyncAppender = new AsyncAppender();
+ asyncAppender.setName("async-test3");
+ asyncAppender.addAppender(vectorAppender);
+ root.addAppender(asyncAppender);
+ for(int i = 0; i < LEN; i++) {
+ root.debug("message"+i);
+ }
+
+ System.out.println("Done loop.");
+ System.out.flush();
+ asyncAppender.close();
+ root.debug("m2");
+
+ Vector v = vectorAppender.getVector();
+ assertEquals(v.size(), LEN);
+ assertTrue(vectorAppender.isClosed());
}
+
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(new AsyncAppenderTestCase("closeTest"));
+ suite.addTest(new AsyncAppenderTestCase("test2"));
+ suite.addTest(new AsyncAppenderTestCase("test3"));
return suite;
}
1.2 +16 -14 jakarta-log4j/tests/src/java/org/apache/log4j/VectorAppender.java
Index: VectorAppender.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/tests/src/java/org/apache/log4j/VectorAppender.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- VectorAppender.java 9 May 2002 17:44:54 -0000 1.1
+++ VectorAppender.java 9 Oct 2002 22:50:07 -0000 1.2
@@ -24,16 +24,14 @@
public Vector vector;
- public
- VectorAppender() {
+ public VectorAppender() {
vector = new Vector();
}
/**
Does nothing.
*/
- public
- void activateOptions() {
+ public void activateOptions() {
}
@@ -42,28 +40,32 @@
method.
*/
- public
- void append(LoggingEvent event) {
- System.out.println("---Vector appender called with message ["+event.getRenderedMessage()+"].");
+ public void append(LoggingEvent event) {
+ //System.out.println("---Vector appender called with message ["+event.getRenderedMessage()+"].");
+ //System.out.flush();
+ try {
+ Thread.currentThread().sleep(100);
+ } catch(Exception e) {
+ }
vector.addElement(event);
}
- public
- Vector getVector() {
+ public Vector getVector() {
return vector;
}
- public
- synchronized
- void close() {
+ public synchronized void close() {
if(this.closed)
return;
this.closed = true;
}
- public
- boolean requiresLayout() {
+ public boolean isClosed() {
+ return closed;
+ }
+
+ public boolean requiresLayout() {
return false;
}
}
1.2 +121 -0 jakarta-log4j/tests/src/java/org/apache/log4j/helpers/PatternParserTestCase.java
1.2 +13 -5 jakarta-log4j/tests/src/java/org/apache/log4j/net/ShortSocketServer.java
Index: ShortSocketServer.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/tests/src/java/org/apache/log4j/net/ShortSocketServer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ShortSocketServer.java 16 Apr 2002 14:36:15 -0000 1.1
+++ ShortSocketServer.java 9 Oct 2002 22:50:08 -0000 1.2
@@ -15,15 +15,21 @@
import org.apache.log4j.Logger;
import org.apache.log4j.LogManager;
import org.apache.log4j.PropertyConfigurator;
+import org.apache.log4j.MDC;
import org.apache.log4j.helpers.LogLog;
import org.apache.log4j.net.SocketNode;
import org.apache.log4j.net.SocketServer;
/**
- This SocketServer exits after just one connection from a client.
-
- @author Ceki Gulcu
-*/
+ * This SocketServer exits after certain number of connections from a
+ * client. This number is determined the totalsTest parameter, that is
+ * the first argument on the commmand line. The second argument,
+ * prefix, determines the prefix of the configuration file to
+ * use. Each run of the server will use a different properties
+ * file. For the i-th run, the path to the file is
+ * (prefix+i+".properties").
+ *
+ * @author Ceki Gulcu */
public class ShortSocketServer {
@@ -46,6 +52,8 @@
LogLog.debug("Listening on port " + SocketServerTestCase.PORT);
ServerSocket serverSocket = new ServerSocket(SocketServerTestCase.PORT);
+ MDC.put("hostID", "shortSocketServer");
+
for(int i = 1; i <= totalTests; i++) {
PropertyConfigurator.configure(prefix+i+".properties");
LogLog.debug("Waiting to accept a new client.");
@@ -61,7 +69,7 @@
static
- void usage(String msg) {
+ void usage(String msg) {
System.err.println(msg);
System.err.println(
"Usage: java " +ShortSocketServer.class.getName() + " totalTests configFilePrefix");
1.3 +155 -3 jakarta-log4j/tests/src/java/org/apache/log4j/net/SocketServerTestCase.java
Index: SocketServerTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/tests/src/java/org/apache/log4j/net/SocketServerTestCase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SocketServerTestCase.java 16 Apr 2002 14:36:15 -0000 1.2
+++ SocketServerTestCase.java 9 Oct 2002 22:50:08 -0000 1.3
@@ -55,6 +55,20 @@
static String PAT4 = "^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some T4 MDC-TEST4 \\[main]\\"
+ " (root|SocketServerTestCase) - Message \\d{1,2}";
+ static String PAT5 = "^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some5 T5 MDC-TEST5 \\[main]\\"
+ + " (root|SocketServerTestCase) - Message \\d{1,2}";
+
+ static String PAT6 = "^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some6 T6 client-test6 MDC-TEST6"
+ + " \\[main]\\ (root|SocketServerTestCase) - Message \\d{1,2}";
+
+ static String PAT7 = "^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some7 T7 client-test7 MDC-TEST7"
+ + " \\[main]\\ (root|SocketServerTestCase) - Message \\d{1,2}";
+
+ // DEBUG some8 T8 shortSocketServer MDC-TEST7 [main] SocketServerTestCase - Message 1
+ static String PAT8 = "^(DEBUG| INFO| WARN|ERROR|FATAL|LETHAL) some8 T8 shortSocketServer"
+ + " MDC-TEST8 \\[main]\\ (root|SocketServerTestCase) - Message \\d{1,2}";
+
+
static String EXCEPTION1 = "java.lang.Exception: Just testing";
static String EXCEPTION2 = "\\s*at .*\\(.*:\\d{1,4}\\)";
@@ -72,8 +86,6 @@
public void setUp() {
System.out.println("Setting up test case.");
- socketAppender = new SocketAppender("localhost", PORT);
- rootLogger.addAppender(socketAppender);
}
public void tearDown() {
@@ -81,8 +93,15 @@
socketAppender = null;
rootLogger.removeAllAppenders();
}
-
+
+ /**
+ * The pattern on the server side: %5p %x [%t] %c %m%n
+ *
+ * We are testing NDC functionality across the wire.
+ */
public void test1() throws Exception {
+ socketAppender = new SocketAppender("localhost", PORT);
+ rootLogger.addAppender(socketAppender);
common("T1", "key1", "MDC-TEST1");
delay(1);
ControlFilter cf = new ControlFilter(new String[]{PAT1, EXCEPTION1,
@@ -93,7 +112,16 @@
assertTrue(Compare.compare(FILTERED, "witness/socketServer.1"));
}
+ /**
+ * The pattern on the server side: %5p %x [%t] %C (%F:%L) %m%n
+ *
+ * We are testing NDC across the wire. Localization is turned off by
+ * default so it is not tested here even if the conversion pattern
+ * uses localization. */
public void test2() throws Exception {
+ socketAppender = new SocketAppender("localhost", PORT);
+ rootLogger.addAppender(socketAppender);
+
common("T2", "key2", "MDC-TEST2");
delay(1);
ControlFilter cf = new ControlFilter(new String[]{PAT2, EXCEPTION1,
@@ -104,8 +132,15 @@
assertTrue(Compare.compare(FILTERED, "witness/socketServer.2"));
}
+ /**
+ * The pattern on the server side: %5p %x [%t] %C (%F:%L) %m%n
+ * meaning that we are testing NDC and locatization functionality
+ * across the wire. */
public void test3() throws Exception {
+ socketAppender = new SocketAppender("localhost", PORT);
socketAppender.setLocationInfo(true);
+ rootLogger.addAppender(socketAppender);
+
common("T3", "key3", "MDC-TEST3");
delay(1);
ControlFilter cf = new ControlFilter(new String[]{PAT3, EXCEPTION1,
@@ -116,10 +151,19 @@
assertTrue(Compare.compare(FILTERED, "witness/socketServer.3"));
}
+ /**
+ * The pattern on the server side: %5p %x %X{key1}%X{key4} [%t] %c{1} - %m%n
+ * meaning that we are testing NDC, MDC and localization functionality across
+ * the wire.
+ */
public void test4() throws Exception {
+ socketAppender = new SocketAppender("localhost", PORT);
socketAppender.setLocationInfo(true);
+ rootLogger.addAppender(socketAppender);
+
NDC.push("some");
common("T4", "key4", "MDC-TEST4");
+ NDC.pop();
delay(1);
ControlFilter cf = new ControlFilter(new String[]{PAT4, EXCEPTION1,
EXCEPTION2, EXCEPTION3});
@@ -129,6 +173,110 @@
assertTrue(Compare.compare(FILTERED, "witness/socketServer.4"));
}
+ /**
+ * The pattern on the server side: %5p %x %X{key1}%X{key5} [%t] %c{1} - %m%n
+ *
+ * The test case uses wraps an AsyncAppender around the
+ * SocketAppender. This tests was written specifically for bug
+ * report #9155.
+
+ * Prior to the bug fix the output on the server did not contain the
+ * MDC-TEST5 string because the MDC clone operation (in getMDCCopy
+ * method) operation is performed twice, once from the main thread
+ * which is correct, and a second time from the AsyncAppender's
+ * dispatch thread which is incrorrect.
+
+ */
+ public void test5() throws Exception {
+ socketAppender = new SocketAppender("localhost", PORT);
+ socketAppender.setLocationInfo(true);
+ AsyncAppender asyncAppender = new AsyncAppender();
+ asyncAppender.setLocationInfo(true);
+ asyncAppender.addAppender(socketAppender);
+ rootLogger.addAppender(asyncAppender);
+
+ NDC.push("some5");
+ common("T5", "key5", "MDC-TEST5");
+ NDC.pop();
+ delay(2);
+ ControlFilter cf = new ControlFilter(new String[]{PAT5, EXCEPTION1,
+ EXCEPTION2, EXCEPTION3});
+
+ Transformer.transform(TEMP, FILTERED, new Filter[] {cf, new LineNumberFilter()});
+ assertTrue(Compare.compare(FILTERED, "witness/socketServer.5"));
+ }
+
+ /**
+ * The pattern on the server side: %5p %x %X{hostID}${key6} [%t] %c{1} - %m%n
+ *
+ * This test checks whether client-side MDC overrides the server side.
+ * It uses an AsyncAppender encapsulating a SocketAppender
+ */
+ public void test6() throws Exception {
+ socketAppender = new SocketAppender("localhost", PORT);
+ socketAppender.setLocationInfo(true);
+ AsyncAppender asyncAppender = new AsyncAppender();
+ asyncAppender.setLocationInfo(true);
+ asyncAppender.addAppender(socketAppender);
+ rootLogger.addAppender(asyncAppender);
+
+ NDC.push("some6");
+ MDC.put("hostID", "client-test6");
+ common("T6", "key6", "MDC-TEST6");
+ NDC.pop();
+ MDC.remove("hostID");
+ delay(2);
+ ControlFilter cf = new ControlFilter(new String[]{PAT6, EXCEPTION1,
+ EXCEPTION2, EXCEPTION3});
+
+ Transformer.transform(TEMP, FILTERED, new Filter[] {cf, new LineNumberFilter()});
+ assertTrue(Compare.compare(FILTERED, "witness/socketServer.6"));
+ }
+
+ /**
+ * The pattern on the server side: %5p %x %X{hostID}${key7} [%t] %c{1} - %m%n
+ *
+ * This test checks whether client-side MDC overrides the server side.
+ */
+ public void test7() throws Exception {
+ socketAppender = new SocketAppender("localhost", PORT);
+ socketAppender.setLocationInfo(true);
+ rootLogger.addAppender(socketAppender);
+
+ NDC.push("some7");
+ MDC.put("hostID", "client-test7");
+ common("T7", "key7", "MDC-TEST7");
+ NDC.pop();
+ MDC.remove("hostID");
+ delay(2);
+ ControlFilter cf = new ControlFilter(new String[]{PAT7, EXCEPTION1,
+ EXCEPTION2, EXCEPTION3});
+
+ Transformer.transform(TEMP, FILTERED, new Filter[] {cf, new LineNumberFilter()});
+ assertTrue(Compare.compare(FILTERED, "witness/socketServer.7"));
+ }
+
+ /**
+ * The pattern on the server side: %5p %x %X{hostID}${key7} [%t] %c{1} - %m%n
+ *
+ * This test checks whether server side MDC works.
+ */
+ public void test8() throws Exception {
+ socketAppender = new SocketAppender("localhost", PORT);
+ socketAppender.setLocationInfo(true);
+ rootLogger.addAppender(socketAppender);
+
+ NDC.push("some8");
+ common("T8", "key8", "MDC-TEST8");
+ NDC.pop();
+ delay(2);
+ ControlFilter cf = new ControlFilter(new String[]{PAT8, EXCEPTION1,
+ EXCEPTION2, EXCEPTION3});
+
+ Transformer.transform(TEMP, FILTERED, new Filter[] {cf, new LineNumberFilter()});
+ assertTrue(Compare.compare(FILTERED, "witness/socketServer.8"));
+ }
+
static
void common(String dc, String key, Object o) {
int i = -1;
@@ -161,6 +309,10 @@
suite.addTest(new SocketServerTestCase("test2"));
suite.addTest(new SocketServerTestCase("test3"));
suite.addTest(new SocketServerTestCase("test4"));
+ suite.addTest(new SocketServerTestCase("test5"));
+ suite.addTest(new SocketServerTestCase("test6"));
+ suite.addTest(new SocketServerTestCase("test7"));
+ suite.addTest(new SocketServerTestCase("test8"));
return suite;
}
}
1.2 +109 -0 jakarta-log4j/tests/src/java/org/apache/log4j/varia/ErrorHandlerTestCase.java
1.3 +14 -1 jakarta-log4j/tests/src/java/org/apache/log4j/xml/XMLLayoutTestCase.java
Index: XMLLayoutTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/tests/src/java/org/apache/log4j/xml/XMLLayoutTestCase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XMLLayoutTestCase.java 29 Apr 2002 14:41:23 -0000 1.2
+++ XMLLayoutTestCase.java 9 Oct 2002 22:50:08 -0000 1.3
@@ -58,6 +58,19 @@
assertTrue(Compare.compare(FILTERED, "witness/xmlLayout.2"));
}
+ public void testCDATA() throws Exception {
+ XMLLayout xmlLayout = new XMLLayout();
+ xmlLayout.setLocationInfo(true);
+ root.addAppender(new FileAppender(xmlLayout, TEMP, false));
+
+ logger.debug("Message with embedded <![CDATA[<hello>hi</hello>]]>.");
+
+ Transformer.transform(TEMP, FILTERED, new Filter[] {new LineNumberFilter(),
+ new XMLTimestampFilter(),
+ new XMLLineAttributeFilter()});
+ assertTrue(Compare.compare(FILTERED, "witness/xmlLayout.3"));
+ }
+
void common() {
int i = -1;
@@ -84,13 +97,13 @@
logger.error("Message " + ++i, e);
root.error("Message " + i, e);
-
}
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(new XMLLayoutTestCase("basic"));
suite.addTest(new XMLLayoutTestCase("locationInfo"));
+ suite.addTest(new XMLLayoutTestCase("testCDATA"));
return suite;
}
1.2 +15 -15 jakarta-log4j/tests/witness/xmlLayout.1
Index: xmlLayout.1
===================================================================
RCS file: /home/cvs/jakarta-log4j/tests/witness/xmlLayout.1,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- xmlLayout.1 25 Apr 2002 21:17:36 -0000 1.1
+++ xmlLayout.1 9 Oct 2002 22:50:08 -0000 1.2
@@ -1,48 +1,48 @@
-<log4j:event category="org.apache.log4j.xml.XMLLayoutTestCase$X" timestamp="XXX" level="INFO" thread="main">
+<log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase$X" timestamp="XXX" level="INFO" thread="main">
<log4j:message><![CDATA[in X() constructor]]></log4j:message>
</log4j:event>
-<log4j:event category="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="DEBUG" thread="main">
+<log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="DEBUG" thread="main">
<log4j:message><![CDATA[Message 0]]></log4j:message>
</log4j:event>
-<log4j:event category="root" timestamp="XXX" level="DEBUG" thread="main">
+<log4j:event logger="root" timestamp="XXX" level="DEBUG" thread="main">
<log4j:message><![CDATA[Message 0]]></log4j:message>
</log4j:event>
-<log4j:event category="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="INFO" thread="main">
+<log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="INFO" thread="main">
<log4j:message><![CDATA[Message 1]]></log4j:message>
</log4j:event>
-<log4j:event category="root" timestamp="XXX" level="INFO" thread="main">
+<log4j:event logger="root" timestamp="XXX" level="INFO" thread="main">
<log4j:message><![CDATA[Message 1]]></log4j:message>
</log4j:event>
-<log4j:event category="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="WARN" thread="main">
+<log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="WARN" thread="main">
<log4j:message><![CDATA[Message 2]]></log4j:message>
</log4j:event>
-<log4j:event category="root" timestamp="XXX" level="WARN" thread="main">
+<log4j:event logger="root" timestamp="XXX" level="WARN" thread="main">
<log4j:message><![CDATA[Message 2]]></log4j:message>
</log4j:event>
-<log4j:event category="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="ERROR" thread="main">
+<log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="ERROR" thread="main">
<log4j:message><![CDATA[Message 3]]></log4j:message>
</log4j:event>
-<log4j:event category="root" timestamp="XXX" level="ERROR" thread="main">
+<log4j:event logger="root" timestamp="XXX" level="ERROR" thread="main">
<log4j:message><![CDATA[Message 3]]></log4j:message>
</log4j:event>
-<log4j:event category="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="FATAL" thread="main">
+<log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="FATAL" thread="main">
<log4j:message><![CDATA[Message 4]]></log4j:message>
</log4j:event>
-<log4j:event category="root" timestamp="XXX" level="FATAL" thread="main">
+<log4j:event logger="root" timestamp="XXX" level="FATAL" thread="main">
<log4j:message><![CDATA[Message 4]]></log4j:message>
</log4j:event>
-<log4j:event category="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="DEBUG" thread="main">
+<log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="DEBUG" thread="main">
<log4j:message><![CDATA[Message 5]]></log4j:message>
<log4j:throwable><![CDATA[java.lang.Exception: Just testing
at org.apache.log4j.xml.XMLLayoutTestCase.common(XMLLayoutTestCase.java:XXX)
@@ -61,7 +61,7 @@
]]></log4j:throwable>
</log4j:event>
-<log4j:event category="root" timestamp="XXX" level="DEBUG" thread="main">
+<log4j:event logger="root" timestamp="XXX" level="DEBUG" thread="main">
<log4j:message><![CDATA[Message 5]]></log4j:message>
<log4j:throwable><![CDATA[java.lang.Exception: Just testing
at org.apache.log4j.xml.XMLLayoutTestCase.common(XMLLayoutTestCase.java:XXX)
@@ -80,7 +80,7 @@
]]></log4j:throwable>
</log4j:event>
-<log4j:event category="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="ERROR" thread="main">
+<log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="ERROR" thread="main">
<log4j:message><![CDATA[Message 6]]></log4j:message>
<log4j:throwable><![CDATA[java.lang.Exception: Just testing
at org.apache.log4j.xml.XMLLayoutTestCase.common(XMLLayoutTestCase.java:XXX)
@@ -99,7 +99,7 @@
]]></log4j:throwable>
</log4j:event>
-<log4j:event category="root" timestamp="XXX" level="ERROR" thread="main">
+<log4j:event logger="root" timestamp="XXX" level="ERROR" thread="main">
<log4j:message><![CDATA[Message 6]]></log4j:message>
<log4j:throwable><![CDATA[java.lang.Exception: Just testing
at org.apache.log4j.xml.XMLLayoutTestCase.common(XMLLayoutTestCase.java:XXX)
1.3 +15 -15 jakarta-log4j/tests/witness/xmlLayout.2
Index: xmlLayout.2
===================================================================
RCS file: /home/cvs/jakarta-log4j/tests/witness/xmlLayout.2,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- xmlLayout.2 29 Apr 2002 14:41:23 -0000 1.2
+++ xmlLayout.2 9 Oct 2002 22:50:08 -0000 1.3
@@ -1,59 +1,59 @@
-<log4j:event category="org.apache.log4j.xml.XMLLayoutTestCase$X" timestamp="XXX" level="INFO" thread="main">
+<log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase$X" timestamp="XXX" level="INFO" thread="main">
<log4j:message><![CDATA[in X() constructor]]></log4j:message>
<log4j:locationInfo class="org.apache.log4j.xml.XMLLayoutTestCase$X" method="<init>" file="XMLLayoutTestCase.java" line="X"/>
</log4j:event>
-<log4j:event category="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="DEBUG" thread="main">
+<log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="DEBUG" thread="main">
<log4j:message><![CDATA[Message 0]]></log4j:message>
<log4j:locationInfo class="org.apache.log4j.xml.XMLLayoutTestCase" method="common" file="XMLLayoutTestCase.java" line="X"/>
</log4j:event>
-<log4j:event category="root" timestamp="XXX" level="DEBUG" thread="main">
+<log4j:event logger="root" timestamp="XXX" level="DEBUG" thread="main">
<log4j:message><![CDATA[Message 0]]></log4j:message>
<log4j:locationInfo class="org.apache.log4j.xml.XMLLayoutTestCase" method="common" file="XMLLayoutTestCase.java" line="X"/>
</log4j:event>
-<log4j:event category="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="INFO" thread="main">
+<log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="INFO" thread="main">
<log4j:message><![CDATA[Message 1]]></log4j:message>
<log4j:locationInfo class="org.apache.log4j.xml.XMLLayoutTestCase" method="common" file="XMLLayoutTestCase.java" line="X"/>
</log4j:event>
-<log4j:event category="root" timestamp="XXX" level="INFO" thread="main">
+<log4j:event logger="root" timestamp="XXX" level="INFO" thread="main">
<log4j:message><![CDATA[Message 1]]></log4j:message>
<log4j:locationInfo class="org.apache.log4j.xml.XMLLayoutTestCase" method="common" file="XMLLayoutTestCase.java" line="X"/>
</log4j:event>
-<log4j:event category="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="WARN" thread="main">
+<log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="WARN" thread="main">
<log4j:message><![CDATA[Message 2]]></log4j:message>
<log4j:locationInfo class="org.apache.log4j.xml.XMLLayoutTestCase" method="common" file="XMLLayoutTestCase.java" line="X"/>
</log4j:event>
-<log4j:event category="root" timestamp="XXX" level="WARN" thread="main">
+<log4j:event logger="root" timestamp="XXX" level="WARN" thread="main">
<log4j:message><![CDATA[Message 2]]></log4j:message>
<log4j:locationInfo class="org.apache.log4j.xml.XMLLayoutTestCase" method="common" file="XMLLayoutTestCase.java" line="X"/>
</log4j:event>
-<log4j:event category="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="ERROR" thread="main">
+<log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="ERROR" thread="main">
<log4j:message><![CDATA[Message 3]]></log4j:message>
<log4j:locationInfo class="org.apache.log4j.xml.XMLLayoutTestCase" method="common" file="XMLLayoutTestCase.java" line="X"/>
</log4j:event>
-<log4j:event category="root" timestamp="XXX" level="ERROR" thread="main">
+<log4j:event logger="root" timestamp="XXX" level="ERROR" thread="main">
<log4j:message><![CDATA[Message 3]]></log4j:message>
<log4j:locationInfo class="org.apache.log4j.xml.XMLLayoutTestCase" method="common" file="XMLLayoutTestCase.java" line="X"/>
</log4j:event>
-<log4j:event category="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="FATAL" thread="main">
+<log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="FATAL" thread="main">
<log4j:message><![CDATA[Message 4]]></log4j:message>
<log4j:locationInfo class="org.apache.log4j.xml.XMLLayoutTestCase" method="common" file="XMLLayoutTestCase.java" line="X"/>
</log4j:event>
-<log4j:event category="root" timestamp="XXX" level="FATAL" thread="main">
+<log4j:event logger="root" timestamp="XXX" level="FATAL" thread="main">
<log4j:message><![CDATA[Message 4]]></log4j:message>
<log4j:locationInfo class="org.apache.log4j.xml.XMLLayoutTestCase" method="common" file="XMLLayoutTestCase.java" line="X"/>
</log4j:event>
-<log4j:event category="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="DEBUG" thread="main">
+<log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="DEBUG" thread="main">
<log4j:message><![CDATA[Message 5]]></log4j:message>
<log4j:throwable><![CDATA[java.lang.Exception: Just testing
at org.apache.log4j.xml.XMLLayoutTestCase.common(XMLLayoutTestCase.java:XXX)
@@ -73,7 +73,7 @@
<log4j:locationInfo class="org.apache.log4j.xml.XMLLayoutTestCase" method="common" file="XMLLayoutTestCase.java" line="X"/>
</log4j:event>
-<log4j:event category="root" timestamp="XXX" level="DEBUG" thread="main">
+<log4j:event logger="root" timestamp="XXX" level="DEBUG" thread="main">
<log4j:message><![CDATA[Message 5]]></log4j:message>
<log4j:throwable><![CDATA[java.lang.Exception: Just testing
at org.apache.log4j.xml.XMLLayoutTestCase.common(XMLLayoutTestCase.java:XXX)
@@ -93,7 +93,7 @@
<log4j:locationInfo class="org.apache.log4j.xml.XMLLayoutTestCase" method="common" file="XMLLayoutTestCase.java" line="X"/>
</log4j:event>
-<log4j:event category="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="ERROR" thread="main">
+<log4j:event logger="org.apache.log4j.xml.XMLLayoutTestCase" timestamp="XXX" level="ERROR" thread="main">
<log4j:message><![CDATA[Message 6]]></log4j:message>
<log4j:throwable><![CDATA[java.lang.Exception: Just testing
at org.apache.log4j.xml.XMLLayoutTestCase.common(XMLLayoutTestCase.java:XXX)
@@ -113,7 +113,7 @@
<log4j:locationInfo class="org.apache.log4j.xml.XMLLayoutTestCase" method="common" file="XMLLayoutTestCase.java" line="X"/>
</log4j:event>
-<log4j:event category="root" timestamp="XXX" level="ERROR" thread="main">
+<log4j:event logger="root" timestamp="XXX" level="ERROR" thread="main">
<log4j:message><![CDATA[Message 6]]></log4j:message>
<log4j:throwable><![CDATA[java.lang.Exception: Just testing
at org.apache.log4j.xml.XMLLayoutTestCase.common(XMLLayoutTestCase.java:XXX)
1.2 +12 -0 jakarta-log4j/tests/witness/PatternParser_mdc
1.2 +35 -0 jakarta-log4j/tests/witness/socketServer.5
1.2 +35 -0 jakarta-log4j/tests/witness/socketServer.6
1.2 +35 -0 jakarta-log4j/tests/witness/socketServer.7
1.2 +35 -0 jakarta-log4j/tests/witness/socketServer.8
1.2 +5 -0 jakarta-log4j/tests/witness/xmlLayout.3
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>