cvs commit: jakarta-log4j/src/xdocs download.xml
[email protected] 22 May 2002 17:15:21 -0000
| Newsgroups | gmane.comp.jakarta.log4j.cvs |
|---|---|
| Message-ID | <[email protected]> |
ceki 02/05/22 10:15:21
Modified: . Tag: v1_2-branch build.xml
docs Tag: v1_2-branch HISTORY
src/java/org/apache/log4j Tag: v1_2-branch
PropertyConfigurator.java
src/java/org/apache/log4j/helpers Tag: v1_2-branch
Loader.java OptionConverter.java
src/java/org/apache/log4j/or Tag: v1_2-branch
RendererMap.java
src/java/org/apache/log4j/spi Tag: v1_2-branch
Configurator.java LoggingEvent.java
src/java/org/apache/log4j/xml Tag: v1_2-branch
DOMConfigurator.java
src/xdocs Tag: v1_2-branch download.xml
Log:
- Log4j now configurators admit NULL as a valid level value. NULL has
the same meaning as the previously available INHERITED value. 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. [*]
Release of log4j 1.2.2 is pending.
Revision Changes Path
No revision
No revision
1.34.2.2 +1 -1 jakarta-log4j/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-log4j/build.xml,v
retrieving revision 1.34.2.1
retrieving revision 1.34.2.2
diff -u -r1.34.2.1 -r1.34.2.2
--- build.xml 15 May 2002 16:08:29 -0000 1.34.2.1
+++ build.xml 22 May 2002 17:15:18 -0000 1.34.2.2
@@ -17,7 +17,7 @@
<!-- prefixed with "env". -->
<property environment="env"/>
- <property name="version" value="1.2.1"/>
+ <property name="version" value="1.2.2"/>
<!-- The base directory relative to which most targets are built -->
<property name="base" value="."/>
No revision
No revision
1.97.2.3 +14 -0 jakarta-log4j/docs/HISTORY
Index: HISTORY
===================================================================
RCS file: /home/cvs/jakarta-log4j/docs/HISTORY,v
retrieving revision 1.97.2.2
retrieving revision 1.97.2.3
diff -u -r1.97.2.2 -r1.97.2.3
--- HISTORY 17 May 2002 12:48:49 -0000 1.97.2.2
+++ HISTORY 22 May 2002 17:15:18 -0000 1.97.2.3
@@ -5,6 +5,20 @@
client code.
[***] Changes requiring important modifications to existing client code.
+ May 22nd, 2002
+
+ - Relase of version 1.2.2
+
+ - Log4j now configurators admit NULL as a valid level value. NULL has
+ the same meaning as the previously available INHERITED value. 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
- Relase of version 1.2.1
No revision
No revision
1.54.2.1 +7 -3 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.54.2.1
diff -u -r1.54 -r1.54.2.1
--- PropertyConfigurator.java 24 Apr 2002 15:03:44 -0000 1.54
+++ PropertyConfigurator.java 22 May 2002 17:15:18 -0000 1.54.2.1
@@ -576,9 +576,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));
}
No revision
No revision
1.17.2.1 +49 -22 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.17.2.1
diff -u -r1.17 -r1.17.2.1
--- Loader.java 24 Apr 2002 21:25:32 -0000 1.17
+++ Loader.java 22 May 2002 17:15:19 -0000 1.17.2.1
@@ -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;
@@ -36,6 +40,9 @@
}
}
+ /* A cache for
+ private static Method GET_TCL_METHOD;
+
/**
This method will search for <code>resource</code> in different
places. The rearch order is as follows:
@@ -64,7 +71,7 @@
try {
if(!java1) {
- classLoader = Thread.currentThread().getContextClassLoader();
+ classLoader = getTCL();
if(classLoader != null) {
LogLog.debug("Trying to find ["+resource+"] using context classloader "
+classLoader+".");
@@ -111,28 +118,48 @@
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 {
+ if(java1) {
+ 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.36.2.1 +2 -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.36.2.1
diff -u -r1.36 -r1.36.2.1
--- OptionConverter.java 9 May 2002 15:43:43 -0000 1.36
+++ OptionConverter.java 22 May 2002 17:15:19 -0000 1.36.2.1
@@ -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,7 +306,7 @@
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.");
No revision
No revision
1.9.2.1 +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.9
retrieving revision 1.9.2.1
diff -u -r1.9 -r1.9.2.1
--- RendererMap.java 24 Apr 2002 01:16:12 -0000 1.9
+++ RendererMap.java 22 May 2002 17:15:20 -0000 1.9.2.1
@@ -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);
No revision
No revision
1.8.2.1 +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.8.2.1
diff -u -r1.8 -r1.8.2.1
--- Configurator.java 28 Sep 2001 13:37:48 -0000 1.8
+++ Configurator.java 22 May 2002 17:15:20 -0000 1.8.2.1
@@ -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.31.2.2 +2 -2 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.2.1
retrieving revision 1.31.2.2
diff -u -r1.31.2.1 -r1.31.2.2
--- LoggingEvent.java 17 May 2002 11:54:06 -0000 1.31.2.1
+++ LoggingEvent.java 22 May 2002 17:15:20 -0000 1.31.2.2
@@ -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;
@@ -316,7 +316,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
No revision
No revision
1.49.2.1 +5 -5 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.49.2.1
diff -u -r1.49 -r1.49.2.1
--- DOMConfigurator.java 4 Apr 2002 19:22:19 -0000 1.49
+++ DOMConfigurator.java 22 May 2002 17:15:20 -0000 1.49.2.1
@@ -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,
No revision
No revision
1.53.2.2 +4 -4 jakarta-log4j/src/xdocs/download.xml
Index: download.xml
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/xdocs/download.xml,v
retrieving revision 1.53.2.1
retrieving revision 1.53.2.2
diff -u -r1.53.2.1 -r1.53.2.2
--- download.xml 17 May 2002 12:48:49 -0000 1.53.2.1
+++ download.xml 22 May 2002 17:15:21 -0000 1.53.2.2
@@ -9,10 +9,10 @@
<meta name="keywords" content="java, logging, tracing, component, framework, API, log4j"/>
<body>
- <section name="log4j version 1.2.1">
- <p>log4j 1.2.1 is now available in <a
- href="../jakarta-log4j-1.2.1.tar.gz"><b>TAR.GZ</b></a> format
- or in <a href="../jakarta-log4j-1.2.1.zip"><b>ZIP</b></a>
+ <section name="log4j version 1.2.2">
+ <p>log4j 1.2.2 is now available in <a
+ href="../jakarta-log4j-1.2.2.tar.gz"><b>TAR.GZ</b></a> format
+ or in <a href="../jakarta-log4j-1.2.2.zip"><b>ZIP</b></a>
format.
</p>