[jboss-jira] [JBoss JIRA] (LOGMGR-120) Thread local log level overriding

David Lloyd (JIRA) issues at jboss.org
Mon Mar 2 12:14:49 EST 2015


    [ https://issues.jboss.org/browse/LOGMGR-120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13045337#comment-13045337 ] 

David Lloyd commented on LOGMGR-120:
------------------------------------

The only reason we need the system property is because thread local access is very slow compared to our existing volatile int read.  So this functionality would have to be enabled by a boolean constant field that we initialize from a system property so that C2 can eliminate the extra code completely when it isn't enabled, something like this:

{code}
        final int effectiveLevel = loggerNode.getEffectiveLevel();
        if ((level.intValue() < effectiveLevel || effectiveLevel == OFF_INT) && !(PER_THREAD_ENABLED && level.intValue() < threadLocal.get().intValue())) {
            return;
        }
{code}

If C2 compiles this code and PER_THREAD_ENABLED is false, it reduces like this:

{code}
        if ((level.intValue() < effectiveLevel || effectiveLevel == OFF_INT) && !(PER_THREAD_ENABLED && level.intValue() < threadLocal.get().intValue())) {
        // becomes:
        if ((level.intValue() < effectiveLevel || effectiveLevel == OFF_INT) && !(false && level.intValue() < threadLocal.get().intValue())) {
        // becomes:
        if ((level.intValue() < effectiveLevel || effectiveLevel == OFF_INT) && !(false)) {
        // becomes:
        if ((level.intValue() < effectiveLevel || effectiveLevel == OFF_INT) && true) {
        // becomes:
        if (level.intValue() < effectiveLevel || effectiveLevel == OFF_INT) {
        // ...which is the original code == just as fast.
{code}


> Thread local log level overriding
> ---------------------------------
>
>                 Key: LOGMGR-120
>                 URL: https://issues.jboss.org/browse/LOGMGR-120
>             Project: JBoss Log Manager
>          Issue Type: Feature Request
>          Components: core
>    Affects Versions: 1.5.2.Final
>            Reporter: Matthew Robson
>            Assignee: James Perkins
>
> Having the ability to force logs down to a filter no matter what the log level is set to.



--
This message was sent by Atlassian JIRA
(v6.3.11#6341)


More information about the jboss-jira mailing list