uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven Bethard (JIRA)" <uima-...@incubator.apache.org>
Subject [jira] Commented: (UIMA-994) Add Logger.getLevel()
Date Fri, 14 Aug 2009 17:29:14 GMT

    [ https://issues.apache.org/jira/browse/UIMA-994?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12743308#action_12743308
] 

Steven Bethard commented on UIMA-994:
-------------------------------------

Another route would be to add a static method somewere, say LoggerUtils.getLogger().

Or we can hope Java 7 gets extension methods. ;-) http://www.artima.com/forums/flat.jsp?forum=276&thread=220205

> Add Logger.getLevel()
> ---------------------
>
>                 Key: UIMA-994
>                 URL: https://issues.apache.org/jira/browse/UIMA-994
>             Project: UIMA
>          Issue Type: New Feature
>            Reporter: Steven Bethard
>
> org.apache.uima.util.Logger should expose a .getLevel() method to match the existing
.setLevel() method. This is needed, for example, by unit tests that test exceptions and want
to temporarily suppress logging messages. In such situations, you want to get the original
logging level, set the level to Level.OFF, and then later restore the original logging level.
Currently, to get the original logging level, you have to write code like:
>     if (UIMAFramework.getLogger().isLoggable(Level.ALL)) {
>        return Level.ALL;
>     } else if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
>        return Level.FINEST;
>     } ...
> Nasty! Adding .getLevel() shouldn't be too difficult -- both org.apache.log4j.Logger
and java.util.logging.Logger already have .getLevel() methods, so these just need appropriately
wrapped.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message