ceki 2004/12/31 07:18:58
Modified: src/java/org/apache/log4j Logger.java Category.java
src/java/org/apache/ugli/impl JDK14Logger.java
src/java/org/apache/ugli LoggerFactory.java
LoggerFactoryAdapter.java
tests build.xml
src/java/org/apache/log4j/helpers OptionConverter.java
Added: . ugli.xml
tests/src/java/org/apache/ugli/impl
MessageFormatterTest.java
src/java/org/apache/ugli/impl SimpleLoggerFA.java
MessageFormatter.java SimpleLogger.java
Removed: tests/src/java/org/apache/log4j/helpers
MessageFormatterTest.java
src/java/org/apache/log4j/helpers MessageFormatter.java
Log:
- Improvements to UGLI. SimpleLogger, NOP and JDK14 implementations need
testing.
- ugli.xml Ant build file can build ugli-nop.jar, ugli-simple.jar and
ugli-jdk14.jar files
- Moved MessageFormatter to o.a.ugli.impl.
Revision Changes Path
1.1 logging-log4j/ugli.xml
Index: ugli.xml
===================================================================
<project name="ugli" default="build.core" basedir="." >
<!-- The directory where source files are stored. -->
<property name="java.source.dir" value="./src/java/"/>
<!-- The directory where source files are stored. -->
<property name="version" value="1.0alpha"/>
<!-- Deprecation warning? -->
<property name="deprecation" value="on"/>
<!-- Destination for compiled files -->
<property name="javac.dest" value="./dist/classes"/>
<property name="UGLI_STEM" value="org/apache/ugli"/>
<property name="ugli.properties" value="dist/classes/ugli.properties"/>
<!-- ================================================================= -->
<!-- Remove all generated (compiled) class files. -->
<!-- ================================================================= -->
<target name="clean" description="Delete all compiled UGLI files.">
<delete dir="${javac.dest}/org/apache/ugli" />
<delete file="${ugli.properties}"/>
</target>
<!-- Build as many source files as we can, except those requiring
JDK 1.4 -->
<target name="build.core" depends="">
<mkdir dir="${javac.dest}" />
<javac srcdir="${java.source.dir}"
destdir="${javac.dest}"
deprecation="on"
includes="${UGLI_STEM}/**/*.java"
excludes="${UGLI_STEM}/impl/JDK14*.java"
debug="${debug}">
</javac>
</target>
<target name="jdk14Check">
<available classname="java.util.logging.Logger"
property="jdk14.present">
</available>
</target>
<target name="build.jdk14" depends="build.core, jdk14Check">
<fail unless="jdk14.present">
Building the UGLI implementation for JDK 1.4 logging
requires the presence of JDK 1.4 or later.
</fail>
<javac srcdir="${java.source.dir}"
destdir="${javac.dest}"
deprecation="on"
includes="${UGLI_STEM}/impl/JDK14*.java"
debug="${debug}">
</javac>
</target>
<!-- Generic target that can build NOP, Simple and JDK14 implementations
as specified by the "jar-name" and "impl" parameters. -->
<target name="ugli-IMPL.jar" depends="build.core">
<delete file="${ugli.properties}"/>
<!-- Much depends on setting up ugli.properties file correctly -->
<propertyfile file="${ugli.properties}" comment="${impl} Logger
implementation">
<entry key="ugli.factoryAdapterClass"
value="org.apache.ugli.impl.${impl}LoggerFA"/>
</propertyfile>
<!-- the NOP classes should always be included -->
<jar jarfile="${jar-name}" basedir="${javac.dest}"
includes="ugli.properties,
${UGLI_STEM}/*.class,
${UGLI_STEM}/impl/MessageFormatter.class,
${UGLI_STEM}/impl/NOP*.class,
${UGLI_STEM}/impl/${impl}*.class"
>
<manifest>
<attribute name="Manifest-version" value="1.0"/>
<section name="org/apache/ugli/">
<attribute name="Implementation-Title" value="${impl}
implementation"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Apache Software
Foundation"/>
</section>
</manifest>
</jar>
<!-- remove ugli.properties when done -->
<delete file="${ugli.properties}"/>
</target>
<target name="ugli-nop.jar" depends="build.core">
<antcall target="ugli-IMPL.jar">
<param name="impl" value="NOP"/>
<param name="jar-name" value="ugli-nop.jar"/>
</antcall>
</target>
<target name="ugli-simple.jar" depends="build.core">
<antcall target="ugli-IMPL.jar">
<param name="impl" value="Simple"/>
<param name="jar-name" value="ugli-simple.jar"/>
</antcall>
</target>
<target name="ugli-jdk14.jar" depends="build.jdk14">
<antcall target="ugli-IMPL.jar">
<param name="impl" value="JDK14"/>
<param name="jar-name" value="ugli-jdk14.jar"/>
</antcall>
</target>
</project>
1.1
logging-log4j/tests/src/java/org/apache/ugli/impl/MessageFormatterTest.java
Index: MessageFormatterTest.java
===================================================================
/*
* Copyright 1999,2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ugli.impl;
import org.apache.ugli.impl.MessageFormatter;
import junit.framework.TestCase;
/**
* @author Ceki Gulcu
*
*/
public class MessageFormatterTest extends TestCase {
public void test1Param() {
String result;
Integer i3 = new Integer(3);
result = MessageFormatter.format("Value is {}.", i3);
assertEquals("Value is 3.", result);
result = MessageFormatter.format("Value is {", i3);
assertEquals("Value is {", result);
result = MessageFormatter.format("Value is {}.", null);
assertEquals("Value is null.", result);
result = MessageFormatter.format("{} is larger than 2.", i3);
assertEquals("3 is larger than 2.", result);
result = MessageFormatter.format("No subst", i3);
assertEquals("No subst", result);
result = MessageFormatter.format("Incorrect {subst", i3);
assertEquals("Incorrect {subst", result);
result = MessageFormatter.format("Escaped \\{} subst", i3);
assertEquals("Escaped \\{} subst", result);
result = MessageFormatter.format("\\{Escaped", i3);
assertEquals("\\{Escaped", result);
result = MessageFormatter.format("\\{}Escaped", i3);
assertEquals("\\{}Escaped", result);
}
public void test2Param() {
String result;
Integer i1 = new Integer(1);
Integer i2 = new Integer(2);
result = MessageFormatter.format("Value {} is larger than {}.", i1, i2);
assertEquals("Value 1 is larger than 2.", result);
result = MessageFormatter.format("Value {} is larger than {}", i1, i2);
assertEquals("Value 1 is larger than 2", result);
result = MessageFormatter.format("{}{}", i1, i2);
assertEquals("12", result);
result = MessageFormatter.format("Val1={}, Val2={", i1, i2);
assertEquals("Val1=1, Val2={", result);
}
}
1.27 +1 -1 logging-log4j/src/java/org/apache/log4j/Logger.java
Index: Logger.java
===================================================================
RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/Logger.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- Logger.java 22 Nov 2004 16:43:39 -0000 1.26
+++ Logger.java 31 Dec 2004 15:18:58 -0000 1.27
@@ -16,8 +16,8 @@
package org.apache.log4j;
-import org.apache.log4j.helpers.MessageFormatter;
import org.apache.log4j.spi.LoggerFactory;
+import org.apache.ugli.impl.MessageFormatter;
/**
1.94 +1 -1 logging-log4j/src/java/org/apache/log4j/Category.java
Index: Category.java
===================================================================
RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/Category.java,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -r1.93 -r1.94
--- Category.java 22 Nov 2004 16:43:39 -0000 1.93
+++ Category.java 31 Dec 2004 15:18:58 -0000 1.94
@@ -32,12 +32,12 @@
package org.apache.log4j;
import org.apache.log4j.helpers.AppenderAttachableImpl;
-import org.apache.log4j.helpers.MessageFormatter;
import org.apache.log4j.helpers.NullEnumeration;
import org.apache.log4j.helpers.ReaderWriterLock;
import org.apache.log4j.spi.AppenderAttachable;
import org.apache.log4j.spi.LoggerRepository;
import org.apache.log4j.spi.LoggingEvent;
+import org.apache.ugli.impl.MessageFormatter;
import java.util.Enumeration;
import java.util.MissingResourceException;
1.2 +4 -5
logging-log4j/src/java/org/apache/ugli/impl/JDK14Logger.java
Index: JDK14Logger.java
===================================================================
RCS file:
/home/cvs/logging-log4j/src/java/org/apache/ugli/impl/JDK14Logger.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JDK14Logger.java 30 Dec 2004 20:44:50 -0000 1.1
+++ JDK14Logger.java 31 Dec 2004 15:18:58 -0000 1.2
@@ -22,7 +22,6 @@
*/
package org.apache.ugli.impl;
-import org.apache.log4j.helpers.MessageFormatter;
import org.apache.ugli.ULogger;
@@ -31,10 +30,10 @@
/**
- * @author ceki
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
+ * A wrapper over @{link java.utill.Logger} which conforms to the
+ * [EMAIL PROTECTED] ULogger} interface.
+ *
+ * @author Ceki Gülcü
*/
public class JDK14Logger implements ULogger {
final Logger logger;
1.1
logging-log4j/src/java/org/apache/ugli/impl/SimpleLoggerFA.java
Index: SimpleLoggerFA.java
===================================================================
/*
* Created on Dec 30, 2004
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package org.apache.ugli.impl;
import java.util.HashMap;
import java.util.Map;
import org.apache.ugli.LoggerFactoryAdapter;
import org.apache.ugli.ULogger;
/**
* An implementation of [EMAIL PROTECTED] LoggerFactoryAdapter} which always
returns
* [EMAIL PROTECTED] SimpleLogger} instances.
*
* @author Ceki Gülcü
*/
public class SimpleLoggerFA implements LoggerFactoryAdapter {
Map map;
SimpleLoggerFA() {
map = new HashMap();
}
/**
* Return an appropriate [EMAIL PROTECTED] SimpleLogger} instance by name.
At this time,
*
*/
/**
* Return an appropriate [EMAIL PROTECTED] SimpleLogger} instance.
* */
public ULogger getLogger(String name) {
ULogger ulogger = (ULogger) map.get(name);
if(ulogger == null) {
ulogger = new SimpleLogger(name);
map.put(name, ulogger);
}
return ulogger;
}
/*
* (non-Javadoc)
* @see org.apache.ugli.LoggerFactoryAdapter#getLogger(java.lang.String,
java.lang.String)
*/
public ULogger getLogger(String domainName, String subDomainName) {
return getLogger(domainName);
}
}
1.1
logging-log4j/src/java/org/apache/ugli/impl/MessageFormatter.java
Index: MessageFormatter.java
===================================================================
/*
* Copyright 1999,2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ugli.impl;
/**
* Formats messages according to very simple rules.
* See [EMAIL PROTECTED] #format(String, Object)} and
* [EMAIL PROTECTED] #format(String, Object, Object)} for more details.
*
* @author Ceki Gülcü
*/
public class MessageFormatter {
static final char DELIM_START = '{';
static final char DELIM_STOP = '}';
/**
* Performs single argument substitution for the 'messagePattern' passed as
* parameter.
* <p>
* For example, <code>MessageFormatter.format("Hi {}.", "there");</code>
will
* return the string "Hi there.".
* <p>
* The {} pair is called the formatting element. It serves to designate the
* location where the argument needs to be inserted within the pattern.
*
* @param messagePattern The message pattern which will be parsed and
formatted
* @param argument The argument to be inserted instead of the formatting
element
* @return The formatted message
*/
public static String format(String messagePattern, Object argument) {
int j = messagePattern.indexOf(DELIM_START);
int len = messagePattern.length();
char escape = 'x';
// if there are no { characters or { is the last character of the messsage
// then we just return messagePattern
if (j == -1 || (j+1 == len)) {
return messagePattern;
} else {
if(j+1 == len) {
}
char delimStop = messagePattern.charAt(j + 1);
if (j > 0) {
escape = messagePattern.charAt(j - 1);
}
if ((delimStop != DELIM_STOP) || (escape == '\\')) {
// invalid DELIM_START/DELIM_STOP pair or espace character is
// present
return messagePattern;
} else {
StringBuffer sbuf = new StringBuffer(len + 20);
sbuf.append(messagePattern.substring(0, j));
sbuf.append(argument);
sbuf.append(messagePattern.substring(j + 2));
return sbuf.toString();
}
}
}
/**
* /**
* Performs a two argument substitution for the 'messagePattern' passed as
* parameter.
* <p>
* For example, <code>MessageFormatter.format("Hi {}. My name is {}.",
* "there", "David");</code> will return the string "Hi there. My name is
David.".
* <p>
* The '{}' pair is called a formatting element. It serves to designate the
* location where the arguments need to be inserted within the message
pattern.
*
* @param messagePattern The message pattern which will be parsed and
formatted
* @param arg1 The first argument to replace the first formatting element
* @param arg2 The second argument to replace the second formatting element
* @return The formatted message
*/
public static String format(String messagePattern, Object arg1, Object
arg2) {
int i = 0;
int len = messagePattern.length();
int j = messagePattern.indexOf(DELIM_START);
StringBuffer sbuf = new StringBuffer(messagePattern.length() + 50);
for (int L = 0; L < 2; L++) {
j = messagePattern.indexOf(DELIM_START, i);
if (j == -1 || (j+1 == len)) {
// no more variables
if (i == 0) { // this is a simple string
return messagePattern;
} else { // add the tail string which contains no variables and
return the result.
sbuf.append(messagePattern.substring(i, messagePattern.length()));
return sbuf.toString();
}
} else {
char delimStop = messagePattern.charAt(j + 1);
if ((delimStop != DELIM_STOP)) {
// invalid DELIM_START/DELIM_STOP pair
sbuf.append(messagePattern.substring(i, messagePattern.length()));
return sbuf.toString();
}
sbuf.append(messagePattern.substring(i, j));
sbuf.append((L == 0) ? arg1 : arg2);
i = j + 2;
}
}
// append the characters following the second {} pair.
sbuf.append(messagePattern.substring(i, messagePattern.length()));
return sbuf.toString();
}
}
1.1
logging-log4j/src/java/org/apache/ugli/impl/SimpleLogger.java
Index: SimpleLogger.java
===================================================================
/*
* Copyright 1999,2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ugli.impl;
import org.apache.ugli.ULogger;
/**
* A simple implementation that logs messages of level INFO or higher on
* the console (<code>System.out<code>).
* <p>
* The output includes the relative time in milliseconds, thread name, the
level,
* logger name, and the message followed by the line separator for the host.
* In log4j terms it amounts to the "%r [%t] %level %logger - %m%n" pattern.
* <pre>
176 [main] INFO examples.Sort - Populating an array of 2 elements in reverse
order.
225 [main] INFO examples.SortAlgo - Entered the sort method.
304 [main] INFO SortAlgo.DUMP - Dump of interger array:
317 [main] INFO SortAlgo.DUMP - Element [0] = 0
331 [main] INFO SortAlgo.DUMP - Element [1] = 1
343 [main] INFO examples.Sort - The next log statement should be an error
message.
346 [main] ERROR SortAlgo.DUMP - Tried to dump an uninitialized array.
at org.log4j.examples.SortAlgo.dump(SortAlgo.java:58)
at org.log4j.examples.Sort.main(Sort.java:64)
467 [main] INFO examples.Sort - Exiting main method.
</pre>
*
* @author Ceki Gülcü
*/
public class SimpleLogger implements ULogger {
String loggerName;
/**
* Mark the time when this class gets loaded into memory.
*/
static private long startTime = System.currentTimeMillis();
static private String LINE_SEPARATOR;
static private String INFO_STR = "INFO";
static private String WARN_STR = "WARN";
static private String ERROR_STR = "ERROR";
/**
* Package access allows [EMAIL PROTECTED] SimpleLoggerFA} to instantiate
SimpleLogger
* instances.
*
*/
SimpleLogger(String name) {
this.loggerName = name;
}
/**
* Always returns false.
*/
public boolean isDebugEnabled() {
return false;
}
/**
* A NOP implementation.
*/
public void debug(Object msg) {
// NOP
}
/**
* A NOP implementation.
*/
public void debug(Object parameterizedMsg, Object param1) {
// NOP
}
/**
* A NOP implementation.
*/
public void debug(Object parameterizedMsg, Object param1, Object param2) {
// NOP
}
/**
* A NOP implementation.
*/
public void debug(Object msg, Throwable t) {
// NOP
}
/**
* This is our internal implementation for logging regular
(non-parameterized)
* log messages.
*
* @param level
* @param message
* @param t
*/
private void log(String level, String message, Throwable t) {
StringBuffer buf = new StringBuffer();
long millis = System.currentTimeMillis();
buf.append(millis-startTime);
buf.append(" [");
buf.append(Thread.currentThread().getName());
buf.append("] ");
buf.append(level);
buf.append(" ");
buf.append(loggerName);
buf.append(" - ");
buf.append(message);
buf.append(LINE_SEPARATOR);
System.out.print(buf.toString());
if(t != null) {
t.printStackTrace(System.out);
}
}
/**
* For parameterized messages, first substitute parameters and then log.
*
* @param level
* @param parameterizedMsg
* @param param1
* @param param2
*/
private void parameterizedLog(String level, Object parameterizedMsg, Object
param1, Object param2) {
if (parameterizedMsg instanceof String) {
String msgStr = (String) parameterizedMsg;
msgStr = MessageFormatter.format(msgStr, param1, param2);
log(level, msgStr, null);
} else {
// To be failsafe, we handle the case where 'messagePattern' is not
// a String. Unless the user makes a mistake, this should not happen.
log(level, parameterizedMsg.toString(), null);
}
}
/**
* Always returns true.
*/
public boolean isInfoEnabled() {
return true;
}
/**
* A simple implementation which always logs messages of level INFO
according
* to the format outlined above.
*/
public void info(Object msg) {
log(INFO_STR, msg.toString(), null);
}
/**
* Perform single parameter substituion before logging the message of level
* INFO according to the format outlined above.
*/
public void info(Object parameterizedMsg, Object param1) {
parameterizedLog(INFO_STR, parameterizedMsg, param1, null);
}
/**
* Perform double parameter substituion before logging the message of level
* INFO according to the format outlined above.
*/
public void info(Object parameterizedMsg, Object param1, Object param2) {
parameterizedLog(INFO_STR, parameterizedMsg, param1, param2);
}
/**
* Log a message of level INFO, including an exception.
*/
public void info(Object msg, Throwable t) {
log(INFO_STR, msg.toString(), t);
}
/**
* Always returns true.
*/
public boolean isWarnEnabled() {
return true;
}
/**
* A simple implementation which always logs messages of level WARN
according
* to the format outlined above.
*/
public void warn(Object msg) {
log(WARN_STR, msg.toString(), null);
}
/**
* Perform single parameter substituion before logging the message of level
* WARN according to the format outlined above.
*/
public void warn(Object parameterizedMsg, Object param1) {
parameterizedLog(WARN_STR, parameterizedMsg, param1, null);
}
/**
* Perform double parameter substituion before logging the message of level
* WARN according to the format outlined above.
*/
public void warn(Object parameterizedMsg, Object param1, Object param2) {
parameterizedLog(WARN_STR, parameterizedMsg, param1, param2);
}
/**
* Log a message of level WARN, including an exception.
*/
public void warn(Object msg, Throwable t) {
log(WARN_STR, msg.toString(), t);
}
/**
* Always returns true.
*/
public boolean isErrorEnabled() {
return true;
}
/**
* A simple implementation which always logs messages of level ERROR
acoording
* to the format outlined above.
*/
public void error(Object msg) {
log(ERROR_STR, msg.toString(), null);
}
/**
* Perform single parameter substituion before logging the message of level
* ERROR according to the format outlined above.
*/
public void error(Object parameterizedMsg, Object param1) {
parameterizedLog(ERROR_STR, parameterizedMsg, param1, null);
}
/**
* Perform double parameter substituion before logging the message of level
* ERROR according to the format outlined above.
*/
public void error(Object parameterizedMsg, Object param1, Object param2) {
parameterizedLog(ERROR_STR, parameterizedMsg, param1, param2);
}
/**
* Log a message of level ERROR, including an exception.
*/
public void error(Object msg, Throwable t) {
log(ERROR_STR, msg.toString(), t);
}
}
1.2 +3 -1 logging-log4j/src/java/org/apache/ugli/LoggerFactory.java
Index: LoggerFactory.java
===================================================================
RCS file:
/home/cvs/logging-log4j/src/java/org/apache/ugli/LoggerFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LoggerFactory.java 30 Dec 2004 20:44:50 -0000 1.1
+++ LoggerFactory.java 31 Dec 2004 15:18:58 -0000 1.2
@@ -25,7 +25,9 @@
/**
* The <code>LoggerFactory</code> can produce Loggers for various logging
APIs,
- * most notably for log4j and JDK 1.4 logging.
+ * most notably for log4j, JDK 1.4 logging. Other implemenations such as
+ * [EMAIL PROTECTED] org.apache.ugli.impl.NOPLogger NOPLogger} and
+ * [EMAIL PROTECTED] org.apache.ugli.impl.SimpleLogger SimpleLogger} are
also supported.
*
* @author Ceki Gülcü
*/
1.2 +12 -1
logging-log4j/src/java/org/apache/ugli/LoggerFactoryAdapter.java
Index: LoggerFactoryAdapter.java
===================================================================
RCS file:
/home/cvs/logging-log4j/src/java/org/apache/ugli/LoggerFactoryAdapter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LoggerFactoryAdapter.java 30 Dec 2004 20:44:50 -0000 1.1
+++ LoggerFactoryAdapter.java 31 Dec 2004 15:18:58 -0000 1.2
@@ -19,6 +19,17 @@
*/
public interface LoggerFactoryAdapter {
+ /**
+ * Return the appropriate named [EMAIL PROTECTED] ULogger} instance.
+ */
public ULogger getLogger(String name);
- public ULogger getLogger(String domainName, String subDomainName);
+
+ /**
+ * Return a [EMAIL PROTECTED] ULogger} instance in <code>domain</code>,
<code>subDomain</code>.
+ *
+ * @param domain
+ * @param subDomain
+ * @return ULogger instance
+ */
+ public ULogger getLogger(String domain, String subDomain);
}
1.82 +1 -1 logging-log4j/tests/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/logging-log4j/tests/build.xml,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- build.xml 24 Dec 2004 08:28:03 -0000 1.81
+++ build.xml 31 Dec 2004 15:18:58 -0000 1.82
@@ -619,7 +619,7 @@
<junit printsummary="yes" fork="yes" haltonfailure="yes">
<classpath refid="tests.classpath"/>
<formatter type="plain" usefile="false"/>
- <test name="org.apache.log4j.helpers.MessageFormatterTest" />
+ <test name="org.apache.ugli.impl.MessageFormatterTest" />
</junit>
</target>
1.46 +12 -6
logging-log4j/src/java/org/apache/log4j/helpers/OptionConverter.java
Index: OptionConverter.java
===================================================================
RCS file:
/home/cvs/logging-log4j/src/java/org/apache/log4j/helpers/OptionConverter.java,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- OptionConverter.java 25 Nov 2004 10:24:20 -0000 1.45
+++ OptionConverter.java 31 Dec 2004 15:18:58 -0000 1.46
@@ -343,7 +343,7 @@
if (className != null) {
try {
Class classObj = Loader.loadClass(className);
-
+ ;
if (!superClass.isAssignableFrom(classObj)) {
getLogger().error(
"A \"" + className + "\" object is not assignable to a \""
@@ -358,7 +358,10 @@
return defaultValue;
}
-
+
+
+ System.out.println("About to call classObj.newInstance(),
"+classObj.getName());
+
return classObj.newInstance();
} catch (Exception e) {
getLogger().error("Could not instantiate class [" + className +
"].", e);
@@ -518,19 +521,22 @@
}
if (clazz != null) {
- getLogger().info("Preferred configurator class: " + clazz);
+ Logger logger = hierarchy.getLogger(OptionConverter.class.getName());
+ logger.info("Preferred configurator class: " + clazz);
+ System.out.println("Before instantiateByClassName");
configurator =
(Configurator) instantiateByClassName(clazz, Configurator.class,
null);
if (configurator == null) {
- getLogger().error("Could not instantiate configurator [" + clazz +
"].");
-
+ logger.error("Could not instantiate configurator [" + clazz + "].");
+
return;
}
} else {
configurator = new PropertyConfigurator();
}
-
+
+ System.out.println("Before configurator.doConfigure()");
configurator.doConfigure(url, hierarchy);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]