Return-Path: Delivered-To: apmail-incubator-uima-user-archive@locus.apache.org Received: (qmail 35348 invoked from network); 15 Apr 2008 21:22:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Apr 2008 21:22:04 -0000 Received: (qmail 35399 invoked by uid 500); 15 Apr 2008 21:22:04 -0000 Delivered-To: apmail-incubator-uima-user-archive@incubator.apache.org Received: (qmail 35377 invoked by uid 500); 15 Apr 2008 21:22:04 -0000 Mailing-List: contact uima-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: uima-user@incubator.apache.org Delivered-To: mailing list uima-user@incubator.apache.org Received: (qmail 35368 invoked by uid 99); 15 Apr 2008 21:22:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Apr 2008 14:22:04 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of steven.bethard@gmail.com designates 64.233.166.178 as permitted sender) Received: from [64.233.166.178] (HELO py-out-1112.google.com) (64.233.166.178) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Apr 2008 21:21:22 +0000 Received: by py-out-1112.google.com with SMTP id a25so2676203pyi.13 for ; Tue, 15 Apr 2008 14:21:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=r7FUQ2EkT0A2CuwajFBNJEQ/BX4XbM0P6SYVdIu0yfA=; b=FwfFEYVX9QwTOlaSV9+SEJFkoJMB91/Apmmtofle2h2cvqKT629ib+Ole0ldwtjenPsW2YQmHxkN3GVt9TC6/Fkk53r9xYVC2MPEeocQQtW7JaMmt1XeFs65yRgrFq0h9CIEZp4asBCh3FmxyK5H9jXkN4pueuJlwmobnzodgFs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=b1WN7G1dL0Hehe4iZfzJkl8DUhiX7gQ23dui0oxDMLs9Ol0Bw8O1y96OsshLGnKbt8XQUpvV2ASxtjtQ6+KW01BmfpiGNCaywjQiouozwHsRb+cA3zylsql+yZgxgIqt/yvSHka90ziTT88KdON8UrIB+l9OSLG3t/k/2OeUSNY= Received: by 10.141.146.4 with SMTP id y4mr4602952rvn.272.1208294493584; Tue, 15 Apr 2008 14:21:33 -0700 (PDT) Received: by 10.140.207.14 with HTTP; Tue, 15 Apr 2008 14:21:33 -0700 (PDT) Message-ID: Date: Tue, 15 Apr 2008 15:21:33 -0600 From: "Steven Bethard" To: "UIMA Users" Subject: Re: getting the current logging level In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Virus-Checked: Checked by ClamAV on apache.org On Tue, Apr 15, 2008 at 12:33 PM, Steven Bethard wrote: > So I'm writing some unit tests that check that my AnalysisEngines are > throwing exceptions in the right places, however, before my test code > can catch the exception, UIMA has already written the exception to the > logger at level SEVERE. The tests still complete correctly, which is > good, but I'd like to be able to suppress UIMA's logging output. To do > this correctly, I should really: > > * get the current logging level > * set the logging level to Level.OFF > * run my exception checking test > * restore the logging level to the original value > > Now org.apache.uima.util.Logger has a setLevel method, but no getLevel > method. How can I get the current logging level? Or is there another > way to temporarily disable logging? So I dug through the UIMA source code, and I've developed the following utility functions which use the java.util.logging APIs instead of the UIMA APIs:: public static Level disableLogging() { Logger logger = Logger.getLogger("org.apache.uima"); while (logger.getLevel() == null) { logger = logger.getParent(); } Level level = logger.getLevel(); logger.setLevel(Level.OFF); return level; } public static void enableLogging(Level level) { Logger logger = Logger.getLogger("org.apache.uima"); logger.setLevel(level); } If anyone sees anything easier than this, please let me know. Steve P.S. Are there any plans to replace the UIMA Logger APIs with the java.util.logging APIs? -- I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a tiny blip on the distant coast of sanity. --- Bucky Katt, Get Fuzzy