uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Burn Lewis (JIRA)" <...@uima.apache.org>
Subject [jira] [Commented] (UIMA-2421) Not able to change log level programmatically with UIMA logger
Date Tue, 18 Jun 2013 17:24:20 GMT

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

Burn Lewis commented on UIMA-2421:

Only the default implementation using the java.util.logging framework (JSR47Logger_impl) has
handlers with levels ... the log4j framework has appenders.  The problem here is that the
default level for the ConsoleHandler is INFO (for the FileHandler it's ALL.)  We could make
setLevel change the level of any handler that would block messages at that level but that
may not be what the user wants.  The safest fix is to set the handler level appropriately
in the properties file, e.g.
    java.util.logging.ConsoleHandler.level = FINEST

When using the JSR47Logger wrapper, the underlying handlers can be retrieved from the root
logger with:
    Handler[] handlers = LogManager.getLogManager().getLogger("").getHandlers();
but their levels would have to be specified using the java.util.logging.Level class instead
of org.apache.uima.util.Level.

> 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

View raw message