[jboss-jira] [JBoss JIRA] (JGRP-2130) Log: cache result of log.isTraceEnabled()

Bela Ban (JIRA) issues at jboss.org
Mon Nov 14 08:41:00 EST 2016


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

Bela Ban commented on JGRP-2130:
--------------------------------

For protocols like NAKACK2 or UNICAST3, the result of log.isTraceEnabled() is cached in {{is_trace}}, but when the log level is changed (via {{setLogLevel()}}, {{is_trace}} is also changed.

> Log: cache result of log.isTraceEnabled()
> -----------------------------------------
>
>                 Key: JGRP-2130
>                 URL: https://issues.jboss.org/browse/JGRP-2130
>             Project: JGroups
>          Issue Type: Enhancement
>            Reporter: Bela Ban
>            Assignee: Bela Ban
>            Priority: Minor
>              Labels: CR1
>             Fix For: 4.0
>
>
> e.g. 
> {noformat}
> boolean trace=log.isTraceEnabled();
> loop {
>    if(trace) ...
> }
> {noformat}
> Unfortunately, {{isTraceEnabled()}} is not free in most scenarios, so the cost of invoking this method should be amortized over multiple calls.
> I don't want to cache this at a global level, or else we wouldn't be able to change the log level at runtime...



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list