Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 84842 invoked from network); 1 Oct 2003 09:59:17 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 1 Oct 2003 09:59:17 -0000 Received: (qmail 68815 invoked by uid 500); 1 Oct 2003 09:58:48 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 68761 invoked by uid 500); 1 Oct 2003 09:58:46 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 68748 invoked from network); 1 Oct 2003 09:58:46 -0000 Received: from unknown (HELO kdcnt4ims01.kdc.capitalone.com) (199.244.214.30) by daedalus.apache.org with SMTP; 1 Oct 2003 09:58:46 -0000 Received: by KDCNT4IMS01 with Internet Mail Service (5.5.2653.19) id ; Wed, 1 Oct 2003 05:59:00 -0400 Message-ID: <73E71EF16978D51197180002A56022D20743CA5C@ngmnt4mbx03.uk.capitalone.com> From: "Hope, Matthew" To: 'Jakarta Commons Developers List' Subject: RE: [digester] turning off commons-logging for unit tests Date: Wed, 1 Oct 2003 05:58:45 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Would suggest putting the resetting of the old logger in the tearDown() method... I have to do this a lot a the moment where all unit tests are run through irrespective of the result of others and this means you don't run any risk of losing the output. Finally will do the same but Junit provides this sort of method for a reason... -----Original Message----- From: Simon Kitching [mailto:simon@ecnetwork.co.nz] Sent: 01 October 2003 02:14 To: Jakarta Commons Developers List Subject: Re: [digester] turning off commons-logging for unit tests On Wed, 2003-10-01 at 13:06, Simon Kitching wrote: > > try { > Log oldLog = digester.getLogger(); > digester.setLogger(new NoOpLog()); > digester.parse( > TestAll.getInputStream(this, "test2.xml")); > digester.setLogger(oldLog); > } > catch(Exception e) { > // yay - exception was correctly generated > // .... > } hmm..try Log oldLog = digester.getLogger(); try { digester.setLogger(new NoOpLog()); digester.parse( TestAll.getInputStream(this, "test2.xml")); } catch(Exception e) { // yay ... etc } finally { digester.setLogger(oldLog); } :-) In fact, it probably doesn't matter a damn about restoring the old logger, as the test has failed. Still, don't want anyone thinking I can't handle exceptions properly! --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org ************************************************************************** The information transmitted herewith is sensitive information intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer. --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org