You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Tony Becker <to...@fortpedro.com> on 2002/07/24 21:02:19 UTC

log4j + junit fix involving junit excluded.properties

I hope this isn't already common knowledge; it wasn't for me.  I'm 
posting this because I couldn't find the whole solution anywhere, I 
just sort of puzzled it out after reading about similar problems 
loading & using JAXP classes.  Sorry if this would be better placed 
on a junit list; honestly, I looked here first, and expect others 
might as well.

I wanted to use JUnit together with my Log4J debugging statements so 
I could see what, if anything, was going wrong during the failed 
tests.  Repeated attempts (using different UI's, properties vs. xml, 
switching to different versions of JUnit and log4j jar files) didn't 
seem to help much.  I kept getting errors that were, variously, 
"could not create an Appender" or "MyAppender not assignable to 
variable of type Appender."

I finally got it working by modifying the JUnit excluded.properties 
file, in the junit.jar under junit/runner/excluded.properties.  In 
order to get the DOMConfigurator working, I had to add org.xml.sax.*, 
org.w3c.dom.*, and org.apache.log4j.* to the lists of things that 
JUnit doesn't try to reload.

Adding just the log4j package (not the DOM/SAX stuff) allows log4j to 
initialize normally from a log4j.properties file on the classpath.

Happy logging and thanks to everyone who contributes, log4j is a great tool.

TB

-- 
Tony Becker, Application Architect
Fort Pedro Informatics LLC
Chicago, IL  USA

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: log4j + junit fix involving junit excluded.properties

Posted by Ceki Gülcü <ce...@qos.ch>.
Tony,


Thank you for sharing the information. Which version of JUnit is this?
Log4j? Can you please try log4j 1.2.6? It is not out yet but you can
get a pre-release version at http://qos.ch/log4j-1.2.6.jar . This
version gives more detailed information on the appender
incompatibility problem.

Could you provide more information on your set up. A small test case
reproducing the problem would be very much appreciated. Thank you.

At 14:02 24.07.2002 -0500, Tony Becker wrote:
>I hope this isn't already common knowledge; it wasn't for me.  I'm posting 
>this because I couldn't find the whole solution anywhere, I just sort of 
>puzzled it out after reading about similar problems loading & using JAXP 
>classes.  Sorry if this would be better placed on a junit list; honestly, 
>I looked here first, and expect others might as well.
>
>I wanted to use JUnit together with my Log4J debugging statements so I 
>could see what, if anything, was going wrong during the failed 
>tests.  Repeated attempts (using different UI's, properties vs. xml, 
>switching to different versions of JUnit and log4j jar files) didn't seem 
>to help much.  I kept getting errors that were, variously, "could not 
>create an Appender" or "MyAppender not assignable to variable of type 
>Appender."
>
>I finally got it working by modifying the JUnit excluded.properties file, 
>in the junit.jar under junit/runner/excluded.properties.  In order to get 
>the DOMConfigurator working, I had to add org.xml.sax.*, org.w3c.dom.*, 
>and org.apache.log4j.* to the lists of things that JUnit doesn't try to reload.
>
>Adding just the log4j package (not the DOM/SAX stuff) allows log4j to 
>initialize normally from a log4j.properties file on the classpath.
>
>Happy logging and thanks to everyone who contributes, log4j is a great tool.
>
>TB
>
>--
>Tony Becker, Application Architect
>Fort Pedro Informatics LLC
>Chicago, IL  USA

--
Ceki

For complete log4j documentation please refer to http://qos.ch/log4jBook.html


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>