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 15:33:16 GMT

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

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

I don't understand why the imperfect mapping matters here. If I call setLevel(CONFIG) and
the imperfect mapping changes that to setLevel(INFO), then when I call getLevel() later, I
absolutely want to get back INFO and not CONFIG. In fact, the imperfect mapping is even more
of a reason to introduce getLevel() because you can then learn when the mapping has done something
you didn't expect.

> 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