I don't have patch installed for my cygwin here at Retek so I thought I'd just post the 4 simple changes to accomplish toggleable daemon threads for AsynchAppender. This is from 1.2.6 source. First, In AsynchAppender, make two constructors out of the one: ----8<----8<----CUT HERE ----8<----8<---- /** Using this constructor will cause events to be lost if the spawning app dies, but has the advantage of allowing the VM to exit as expected when using an AsynchAppender in an appliction that you can't control its startup behavior (like a commercial J2EE container) */ public AsyncAppender() { this(true); } /** Decide carefully: you want Log4j to use daemon threads or user threads. Each has its own implications. @param boolean daemon, set to true, your app's exit will reap log4j's threads even if there are still logging to do, false will keep the VM resident until the thread is interrupted externally. */ public AsyncAppender(boolean daemon) { // Note: The dispatcher code assumes that the aai is set once and // for all. aai = new AppenderAttachableImpl(); dispatcher = new Dispatcher(bf, this, daemon); dispatcher.start(); } ----8<----8<----CUT HERE ----8<----8<---- Then, down in the Dispatcher inner class, make the corresonding changes in the one constructor to make two constructors. ----8<----8<----CUT HERE ----8<----8<---- Dispatcher(BoundedFIFO bf, AsyncAppender container) { this(bf, container, true); } Dispatcher(BoundedFIFO bf, AsyncAppender container, boolean daemon) { this.bf = bf; this.container = container; this.aai = container.aai; // It is the user's responsibility to close appenders before // exiting. this.setDaemon(daemon); // set the dispatcher priority to lowest possible value this.setPriority(Thread.MIN_PRIORITY); this.setName("Dispatcher-"+getName()); // set the dispatcher priority to MIN_PRIORITY plus or minus 2 // depending on the direction of MIN to MAX_PRIORITY. //+ (Thread.MAX_PRIORITY > Thread.MIN_PRIORITY ? 1 : -1)*2); } ----8<----8<----CUT HERE ----8<----8<----
-----Original Message----- From: Ceki Gülcü [mailto:[EMAIL PROTECTED]] Sent: Thu 9/26/2002 4:23 PM To: Log4J Developers List Cc: Subject: RE: log4j.ignoreTCL Are you running the tests using Ant? If the junit tests are run is a separate JVM the ignoreTCL directive will not be seen by the separate JVM. For example, <junit fork="yes"> <jvmarg value="-Dlog4j.ignoreTCL=true"/> .... </junit> See Ant documentation for further details. Which version of Junit is this? Can you provide details about junit.runner.TestCaseClassLoader? What are its parents? Does it have a copy of log4j.jar accessible to it? At 15:11 26.09.2002 -0600, you wrote: >Ceki, > >When I run a JUnit TestCase which initiate Torque in the setUp() method, > >I got the following messages from log4j: > >log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not >assignable to a "org.apache.log4j.Appender" variable. >log4j:ERROR The class "org.apache.log4j.Appender" was loaded by >log4j:ERROR [junit.runner.TestCaseClassLoader@45fde0] whereas object of >type >log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by >[sun.misc.Launcher$AppClassLoader@ac738]. >log4j:ERROR Could not instantiate appender named "STDOUT". >log4j:ERROR A "org.apache.log4j.FileAppender" object is not assignable >to a "org.apache.log4j.Appender" variable. >log4j:ERROR The class "org.apache.log4j.Appender" was loaded by >log4j:ERROR [junit.runner.TestCaseClassLoader@45fde0] whereas object of >type >log4j:ERROR "org.apache.log4j.FileAppender" was loaded by >[sun.misc.Launcher$AppClassLoader@ac738]. >log4j:ERROR Could not instantiate appender named "default". >log4j:ERROR A "org.apache.log4j.FileAppender" object is not assignable >to a "org.apache.log4j.Appender" variable. >log4j:ERROR The class "org.apache.log4j.Appender" was loaded by >log4j:ERROR [junit.runner.TestCaseClassLoader@45fde0] whereas object of >type >log4j:ERROR "org.apache.log4j.FileAppender" was loaded by >[sun.misc.Launcher$AppClassLoader@ac738]. >log4j:ERROR Could not instantiate appender named "org.apache.torque". >log4j:WARN No appenders could be found for logger >(org.apache.torque.Torque). >log4j:WARN Please initialize the log4j system properly. > >The exception that I got from my unit test was: >java.lang.ExceptionInInitializerError: >org.apache.commons.logging.LogConfigurationException: >org.apache.commons.logging.LogConfigurationException: >...(the line was cut from on the Junit console) The rest of the stack could have been helpful... >After I posted my problem to log4j-dev, I found that it should be posted > >to log4j-user so I posted it again to log4j-user right after. The more details you provide the easier will it be to identify and fix the problem.... >Pricilla Yin -- Ceki TCP implementations will follow a general principle of robustness: be conservative in what you do, be liberal in what you accept from others. -- Jon Postel, RFC 793 -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >
<<application/ms-tnef>>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>