[jboss-jira] [JBoss JIRA] (LOGTOOL-83) Ability to annotate @LogMessage as "log once"
David Lloyd (JIRA)
issues at jboss.org
Thu Feb 5 09:26:49 EST 2015
[ https://issues.jboss.org/browse/LOGTOOL-83?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13037984#comment-13037984 ]
David Lloyd commented on LOGTOOL-83:
------------------------------------
I've gotten more requests for this feature. Here's how I think it should be done.
Introduce a {{@Once}} annotation. If the annotation is present on a log method, create a final *instance* field of type {{AtomicBoolean}} whose name is associated with the log method name (ensuring that overloaded methods are handled correctly, such that only one variable is created for all overloads). Then wrap the corresponding method body in a block like this:
{code}
void theLogMethod(String foo, int bar) {
if (theLogMethod_$Once.compareAndSet(false, true) {
// ... original method body goes here ...
}
}
{code}
Maybe some future version could get fancy with a SwitchPoint or something, but that's something that can be explored later.
> Ability to annotate @LogMessage as "log once"
> ---------------------------------------------
>
> Key: LOGTOOL-83
> URL: https://issues.jboss.org/browse/LOGTOOL-83
> Project: Log Tool
> Issue Type: Feature Request
> Reporter: Steve Ebersole
> Assignee: James Perkins
>
> Ideally via an optional annotation ({{@LogOnce}}?)
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)
More information about the jboss-jira
mailing list