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:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to