You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Marshall Schor (JIRA)" <de...@uima.apache.org> on 2013/04/30 00:34:16 UTC

[jira] [Commented] (UIMA-2421) Not able to change log level programmatically with UIMA logger

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

Marshall Schor commented on UIMA-2421:
--------------------------------------

This reference http://www.onjava.com/pub/a/onjava/2002/06/19/log.html?page=2 says the (common?) approach for this is to set levels on both the main logger, and on all (or some subset) of the handlers, in a loop, perhaps.  For this, you do need a way to access the handlers for a logger.

I would be in favor of following the common practice.  But that would require defining Handlers.  Currently, the UIMA Framework has one logging API, and 3 alternative implementations: a custom one, one that is the built-in-to-Java logging framework, and one using Log4J logger impl.  The custom one doesn't have the idea of handlers, for instance. 

I'm ignorant about the history of why we have 3 implementations for logging, and whether or not we need to continue support for all of them going forward.  I suspect that our custom one is (a) probably never used, because the default if not overridden is to use the one built-in-to-Java, and (b) was there before there was a standard logging framework in Java.
                
> Not able to change log level programmatically with UIMA logger
> --------------------------------------------------------------
>
>                 Key: UIMA-2421
>                 URL: https://issues.apache.org/jira/browse/UIMA-2421
>             Project: UIMA
>          Issue Type: Bug
>          Components: Core Java Framework
>    Affects Versions: 2.4.0SDK
>            Reporter: Jerry Cwiklik
>            Priority: Minor
>             Fix For: 2.4.1SDK
>
>
> UIMA Logger setLevel(Level) only partially works. It changes the level associated with the logger, but its not changing a level in any of its handlers (like ConsoleHandler). So the code,
> logger.setLevel(Level.FINEST);
> if ( logger.isLoggable(Level.FINEST) ) {
> } 
> works fine. What does *not* work is the following:
> logger.log(Level.FINEST, aMessage);
> The only workaround for this is to use, now deprecated, setOutputStream(System.out). 
> Possible fix could be Uima Logger API extension to return an array of handlers associated with a logger. The client application can than decide appropriate log levels for each of the handlers programatically. 
> Another fix for this is to change setLevel(Level) implementation, and apply the new setting across all the handlers associated with the logger. This is less flexible than the first but perhaps more convenient.
> Any thoughts? 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira