ceki 01/04/20 12:40:06 Modified: build build.xml docs HISTORY download.html earlier.html history.html manual.html src/java/org/apache/log4j Category.java src/java/org/apache/log4j/helpers Loader.java src/java/org/apache/log4j/test defaultInit src/xdocs download.xml history.xml Log: - Mathias Boagert observed that in version 1.1b3 the search algorithm for the resource used in automatic log4j configuration was different than in 1.0.x. Beta4 uses a more powerful mechanism which is also compatible with 1.0.x. [*] - Small documentation changes. Revision Changes Path 1.23 +2 -2 jakarta-log4j/build/build.xml Index: build.xml =================================================================== RCS file: /home/cvs/jakarta-log4j/build/build.xml,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- build.xml 2001/04/18 17:21:01 1.22 +++ build.xml 2001/04/20 19:39:51 1.23 @@ -9,7 +9,7 @@ <!-- ================================================================= --> <project name="log4j" default="usage" basedir=".." > - <property name="version" value="1.1b3"/> + <property name="version" value="1.1b4"/> <!-- The base directory relative to which most targets are built --> <property name="base" value="."/> @@ -238,7 +238,7 @@ excludes="**/StressCategory*, **/TTCC*, **/SimpleLayout.*, **/AsyncAppender.*, **/Dispatcher.*, **/BoundedFIFO.*, **/Syslog*, **/RelativeTimeDateFormat.*, - ${stem}/gui/**/*.class, **/Loader.class, + ${stem}/gui/**/*.class, **/UnitTest*.class, ${stem}/or/MessageRenderer.class, ${stem}/spi/TriggeringEventEvaluator.class 1.35 +16 -0 jakarta-log4j/docs/HISTORY Index: HISTORY =================================================================== RCS file: /home/cvs/jakarta-log4j/docs/HISTORY,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- HISTORY 2001/04/18 17:21:05 1.34 +++ HISTORY 2001/04/20 19:39:53 1.35 @@ -5,6 +5,22 @@ client code. [***] Changes requiring important modifications to existing client code. + + April 20, 2001 + + - Release of version 1.1b4 + + - Mathias Boagert observed that in version 1.1b3 the search algorithm + for the resource used in automatic log4j configuration was + different than in 1.0.x. Beta4 uses a more powerful mechanism which + is also compatible with 1.0.x. [*] + + - Paul Glezen correctly observed that if log4j is deployed in a + client/server mode where multiple log4j clients log to a log4j + server, all hosts must be upgraded to version 1.1 in one go because + the internal LoggingEvent class used in client/server communication + changed in log4j 1.1. + April 18, 2001 - Release of version 1.1b3 1.19 +4 -4 jakarta-log4j/docs/download.html Index: download.html =================================================================== RCS file: /home/cvs/jakarta-log4j/docs/download.html,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- download.html 2001/04/18 17:21:07 1.18 +++ download.html 2001/04/20 19:39:53 1.19 @@ -106,18 +106,18 @@ <table border="0" cellspacing="0" cellpadding="2" width="100%"> <tr><td bgcolor="#525D76"> <font color="#ffffff" face="arial,helvetica,sanserif"> - <a name="log4j version 1.1beta3 (release candidate)"><strong>log4j version 1.1beta3 (release candidate)</strong></a> + <a name="log4j version 1.1beta4 (release candidate)"><strong>log4j version 1.1beta4 (release candidate)</strong></a> </font> </td></tr> <tr><td> <blockquote> - <p>Downlaod version 1.1beta3 (release candiate) including <i>full -source code</i>, class files and documentation in <a href="../jakarta-log4j-1.1b3.tar.gz"><b>TAR.GZ</b></a> format or in <a href="../jakarta-log4j-1.1b3.zip"><b>ZIP</b></a> format. You may elect + <p>Downlaod version 1.1beta4 (release candiate) including <i>full +source code</i>, class files and documentation in <a href="../jakarta-log4j-1.1b4.tar.gz"><b>TAR.GZ</b></a> format or in <a href="../jakarta-log4j-1.1b4.zip"><b>ZIP</b></a> format. You may elect to browse log4j <a href="documentation.html"><b>documentation</b></a> online.</p> <p>This release candidate should be sanctioned as the official 1.1 release after a short period of probation.</p> - <p>Version 1.1b3 is the 21st major public release of log4j. It is 100% + <p>Version 1.1b4 is the 21st major public release of log4j. It is 100% backward compatible with log4j version 1.0.x.</p> <p>We also maintain a list of <a href="earlier.html">earlier versions</a> of log4j for download, intended for the curious 1.9 +0 -11 jakarta-log4j/docs/earlier.html Index: earlier.html =================================================================== RCS file: /home/cvs/jakarta-log4j/docs/earlier.html,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- earlier.html 2001/04/17 19:59:20 1.8 +++ earlier.html 2001/04/20 19:39:54 1.9 @@ -122,17 +122,6 @@ Download full package in <a href="../jakarta-log4j-1.0.4.tgz">TGZ</a> format. </dd> - <dt><b>jakarta-log4j-1.1b1</b></dt> - <dd> - Download full package in <a href="../jakarta-log4j-1.1b1.tar.tgz">TAR.GZ</a> format. - </dd> - - <dt><b>jakarta-log4j-1.1b2</b></dt> - <dd> - Download full package in <a href="../jakarta-log4j-1.1b2.tar.tgz">TAR.GZ</a> format. - </dd> - - </dl> </blockquote> </td></tr> 1.11 +5 -5 jakarta-log4j/docs/history.html Index: history.html =================================================================== RCS file: /home/cvs/jakarta-log4j/docs/history.html,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- history.html 2001/04/17 19:59:20 1.10 +++ history.html 2001/04/20 19:39:54 1.11 @@ -115,8 +115,7 @@ summary of changes and additions. Users frequently report bugs that are solved in newer versions of log4j. Please have a look at the history file before asking for help.</p> - <p>The project's official address changed to <a href="http://jakarta.apache.org/log4j">http://jakarta.apache.org/log4j</a> -as of January 2001.</p> + <p>The project's official URL is <a href="http://jakarta.apache.org/log4j">http://jakarta.apache.org/log4j</a>.</p> <p>Many thanks to all the log4j users who keep sending us input and sometimes even <b><a href="praise.html">praise</a></b> for our collective effort.</p> @@ -125,9 +124,10 @@ hierarchical categories back in 1996. Their idea is still at the heart of log4j.</p> <p>The package was considerably improved over the years by Ceki -Gülcü while working for the <a href="http://www.zurich.ibm.com"><b>IBM Zurich Research -Laboratory</b></a>. Although no longer with IBM, Ceki still owns and -maintains log4j.</p> +Gülcü while working at the <a href="http://www.zurich.ibm.com"><b>IBM Zurich Research +Laboratory</b></a>. However, log4j is no longer associated nor +supported with IBM. Please do not refer to log4j as IBM's logging +package.</p> <p>Special thanks to M. Niksch from ZRL for his assistance on many large and small matters. The Apache members, Pier Fumagalli and Sam Ruby in particular, have been extremely helpful in easing the move to 1.11 +12 -5 jakarta-log4j/docs/manual.html Index: manual.html =================================================================== RCS file: /home/cvs/jakarta-log4j/docs/manual.html,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- manual.html 2001/04/11 21:38:15 1.10 +++ manual.html 2001/04/20 19:39:55 1.11 @@ -730,10 +730,10 @@ environment. In particular, there are no default log4j appenders. Under certain well-defined circumstances however, the static inializer of the <code>Category</code> class will attempt to -automatically configure log4j. The Java languuage guarantees that the +automatically configure log4j. The Java language guarantees that the static initializer of a class is called once and only during the -loading of a class into memory. Nevertheless, different classloaders -may load distinct copies of the same class. +loading of a class into memory. (Although different classloaders may +load distinct copies of the same class.) <p>The default intialization is very useful in environments where the exact entry point to the application depends on the runtime @@ -759,8 +759,15 @@ <p><li>If the resource variable cannot be converted to a URL, for example due to a <code>MalformedURLException</code>, then search for - the <code>resource</code> from the classpath using a classloader. The - result of the search, if successful, should be a well-formed URL. + the <code>resource</code> from the classpath by calling + <code>org.apache.log4j.helpers.Loader.getResource(resource, + Category.class)</code>. Note that "log4j.properties" is a a malformed + URL and hence it falls to this case. + + <p>See <a + href="api/org/apache/log4j/helpers/Loader.html#getResouce">Loader.getResouce()</a> + for the list of searched locations which is rather complex in + itself.. <p><li>If the URL could not be found, abort default initialization. 1.26 +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.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- Category.java 2001/04/17 22:32:22 1.25 +++ Category.java 2001/04/20 19:39:58 1.26 @@ -129,22 +129,18 @@ DEFAULT_CONFIGURATION_FILE); URL url = null; try { - url = new URL(resource); - } catch (MalformedURLException ex) { - // so, resource is not a URL: // attempt to get the resource from the class path - url = ClassLoader.getSystemResource(resource); - if(url == null) { - // Is it under org/apache/log4j somewhere in the classpath? - url = Category.class.getResource(resource); - } + url = new URL(resource); + } catch (MalformedURLException ex) { + url = org.apache.log4j.helpers.Loader.getResource(resource, Category.class); } // 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."); OptionConverter.selectAndConfigure(url, defaultHierarchy); } else { LogLog.debug("Could not find resource: ["+resource+"]."); 1.3 +109 -33 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.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Loader.java 2000/12/14 21:07:45 1.2 +++ Loader.java 2001/04/20 19:40:00 1.3 @@ -8,49 +8,125 @@ package org.apache.log4j.helpers; import java.net.URL; -import java.awt.Image; -import java.awt.Toolkit; +//import java.awt.Image; +//import java.awt.Toolkit; /** - * Load things from a jar file. - * - * Created: Thu Dec 16 16:11:05 1999 <br> - * - * @author Sven Reimers + Load resources (or images) from various sources. + + @author Sven Reimers + @author Ceki Gülcü */ public class Loader extends java.lang.Object { - public static Image getGIF_Image ( String path ) { - Image img = null; - try { - URL url = ClassLoader.getSystemResource(path); - System.out.println(url); - img = (Image) (Toolkit.getDefaultToolkit()).getImage(url); - } - catch (Exception e) { - System.out.println("Exception occured: " + e.getMessage() + - " - " + e ); - + + /** + This method will search for <code>resource</code> in different + places. The rearch order is as follows: + + <ol> + + <p><li>Search for <code>fully/qualified/clazz/name/resource</code> + with the {@link ClassLoader} that loaded <code>clazz</code>. + + <p><li>Search for <code>fully/qualified/clazz/name/resource</code> + with the <code>null</code> (bootstrap) class loader. + + <p><li>Search for <code>resource</code> with the class loader + that loaded <code>clazz</code>. It that fails, try recursively + with the parent class loader, upto and including the bootstrap + class loader. + + </ol> + + + */ + static + public + URL getResource(String resource, Class clazz) { + + URL url = null; + + + // Is it under CLAZZ/resource somewhere in the classpath? + // where CLAZZ is the fully qualified name of clazz where dots have been + // changed to directory separators + LogLog.debug("Trying to find ["+resource+"] using Class.getResource()."); + url = clazz.getResource(resource); + if(url != null) + return url; + + // attempt to get the resource under CLAZZ/resource from the system class path + String fullyQualified = resolveName(resource, clazz); + LogLog.debug("Trying to find ["+fullyQualified+ + "] using ClassLoader.getSystemResource()."); + url = ClassLoader.getSystemResource(fullyQualified); + if(url != null) + return url; + + // Try all the class loaders of clazz and parents looking resource + for(ClassLoader loader = clazz.getClassLoader(); loader != null; + loader = loader.getParent()) { + LogLog.debug("Trying to find ["+resource+"] using "+loader+" class loader."); + url = loader.getResource(resource); + if(url != null) + return url; } - return (img); + + + + // attempt to get the resource from the class path + LogLog.debug("Trying to find ["+resource+"] using ClassLoader.getSystemResource()."); + url = ClassLoader.getSystemResource(resource); + return url; } - public static Image getGIF_Image ( URL url ) { - Image img = null; - try { - System.out.println(url); - img = (Image) (Toolkit.getDefaultToolkit()).getImage(url); - } catch (Exception e) { - System.out.println("Exception occured: " + e.getMessage() + - " - " + e ); - + /** + Add the fully qualified name of a class before resource (replace . with /). + */ + static + String resolveName(String resource, Class clazz) { + String fqcn = clazz.getName(); + int index = fqcn.lastIndexOf('.'); + if (index != -1) { + fqcn = fqcn.substring(0, index).replace('.', '/'); + resource = fqcn+"/"+resource; } - return (img); + return resource; } - public static URL getHTML_Page ( String path ) { - URL url = null; - return (url = ClassLoader.getSystemResource(path)); - } + + //public static Image getGIF_Image ( String path ) { + // Image img = null; + // try { + // URL url = ClassLoader.getSystemResource(path); + // System.out.println(url); + // img = (Image) (Toolkit.getDefaultToolkit()).getImage(url); + // } + // catch (Exception e) { + // System.out.println("Exception occured: " + e.getMessage() + + // " - " + e ); + // + // } + // return (img); + //} + // + //public static Image getGIF_Image ( URL url ) { + // Image img = null; + // try { + // System.out.println(url); + // img = (Image) (Toolkit.getDefaultToolkit()).getImage(url); + // } catch (Exception e) { + // System.out.println("Exception occured: " + e.getMessage() + + // " - " + e ); + // + // } + // return (img); + //} + // + //public static URL getHTML_Page ( String path ) { + // URL url = null; + // return (url = ClassLoader.getSystemResource(path)); + // } } 1.4 +1 -1 jakarta-log4j/src/java/org/apache/log4j/test/defaultInit Index: defaultInit =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/test/defaultInit,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- defaultInit 2001/01/05 21:09:04 1.3 +++ defaultInit 2001/04/20 19:40:02 1.4 @@ -16,7 +16,7 @@ touch $TEMP fi - java $1 org.apache.log4j.test.DefaultInit + java $1 -Dlog4j.debug org.apache.log4j.test.DefaultInit check witness/definit.$TEST $TEMP; echo "OK." } 1.15 +5 -5 jakarta-log4j/src/xdocs/download.xml Index: download.xml =================================================================== RCS file: /home/cvs/jakarta-log4j/src/xdocs/download.xml,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- download.xml 2001/04/18 17:21:13 1.14 +++ download.xml 2001/04/20 19:40:04 1.15 @@ -32,19 +32,19 @@ --> -<section name="log4j version 1.1beta3 (release candidate)"> +<section name="log4j version 1.1beta4 (release candidate)"> -<p>Downlaod version 1.1beta3 (release candiate) including <i>full +<p>Downlaod version 1.1beta4 (release candiate) including <i>full source code</i>, class files and documentation in <a -href="../jakarta-log4j-1.1b3.tar.gz"><b>TAR.GZ</b></a> format or in <a -href="../jakarta-log4j-1.1b3.zip"><b>ZIP</b></a> format. You may elect +href="../jakarta-log4j-1.1b4.tar.gz"><b>TAR.GZ</b></a> format or in <a +href="../jakarta-log4j-1.1b4.zip"><b>ZIP</b></a> format. You may elect to browse log4j <a href="documentation.html"><b>documentation</b></a> online.</p> <p>This release candidate should be sanctioned as the official 1.1 release after a short period of probation.</p> -<p>Version 1.1b3 is the 21st major public release of log4j. It is 100% +<p>Version 1.1b4 is the 21st major public release of log4j. It is 100% backward compatible with log4j version 1.0.x.</p> <p>We also maintain a list of <a href="earlier.html">earlier 1.6 +6 -6 jakarta-log4j/src/xdocs/history.xml Index: history.xml =================================================================== RCS file: /home/cvs/jakarta-log4j/src/xdocs/history.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- history.xml 2001/02/23 22:12:43 1.5 +++ history.xml 2001/04/20 19:40:05 1.6 @@ -15,9 +15,8 @@ are solved in newer versions of log4j. Please have a look at the history file before asking for help.</p> -<p>The project's official address changed to <a -href="http://jakarta.apache.org/log4j">http://jakarta.apache.org/log4j</a> -as of January 2001.</p> +<p>The project's official URL is <a +href="http://jakarta.apache.org/log4j">http://jakarta.apache.org/log4j</a>.</p> <p>Many thanks to all the log4j users who keep sending us input and sometimes even <b><a href="praise.html">praise</a></b> for our @@ -30,10 +29,11 @@ of log4j.</p> <p>The package was considerably improved over the years by Ceki -Gülcü while working for the <a +Gülcü while working at the <a href="http://www.zurich.ibm.com"><b>IBM Zurich Research -Laboratory</b></a>. Although no longer with IBM, Ceki still owns and -maintains log4j.</p> +Laboratory</b></a>. However, log4j is no longer associated nor +supported with IBM. Please do not refer to log4j as IBM's logging +package.</p> <p>Special thanks to M. Niksch from ZRL for his assistance on many large and small matters. The Apache members, Pier Fumagalli and Sam --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]