You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Michael Kohout (JIRA)" <ji...@apache.org> on 2017/01/19 17:37:26 UTC
[jira] [Issue Comment Deleted] (GROOVY-6932) @Log annotation does
not check logging enablement inside closures
[ https://issues.apache.org/jira/browse/GROOVY-6932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Kohout updated GROOVY-6932:
-----------------------------------
Comment: was deleted
(was: I'm still not seeing this issue fixed-it still evaluates the strings in the levels not enabled. Here's a Spock test that duplicates this issue.
This is with the just released Groovy 2.4.8 and slf4j 1.7.21.
Is there something I don't understand about how Groovy should build GroovyStrings?
See my attached Spec.)
> @Log annotation does not check logging enablement inside closures
> -----------------------------------------------------------------
>
> Key: GROOVY-6932
> URL: https://issues.apache.org/jira/browse/GROOVY-6932
> Project: Groovy
> Issue Type: Bug
> Components: groovy-runtime
> Affects Versions: 2.2.0, 2.3.3
> Environment: Windows 7, Groovy 2.3.3, JDK 1.8.0_05
> Reporter: Shorn
> Assignee: Paul King
> Priority: Minor
> Fix For: 2.4.8
>
> Attachments: LogAstProblem.groovy, LoggingSpec.groovy
>
>
> Groovy doesn't do a check for whether the log level is enabled when the log statement is made from inside a closure.
> I believe the attached script should not print "called with 3".
> Result on my machine is:
> Groovy version: 2.3.3
> Java version: 1.8.0_05-b13
> OS: Windows 7
> called with 1
> 12:03:30.119 [main] INFO TestCode - blah: 1
> called with 3
> Script:
> {code}
> @Grapes([
> @Grab(group='org.slf4j', module='slf4j-api', version='1.7+'),
> @Grab(group='ch.qos.logback', module='logback-classic', version='1.+')])
> import groovy.util.logging.Slf4j
> new TestCode().doSomethingThatLogs()
> @Slf4j
> class TestCode {
> void doSomethingThatLogs(){
> println "Groovy version: ${GroovySystem.version}"
> println "Java version: ${System.properties["java.runtime.version"]}"
> println "OS: ${System.properties["os.name"]}"
> println ""
> log.info createLogString(1)
> log.trace createLogString(2)
> Closure c = { log.trace createLogString(3) }
> c()
> }
> String createLogString(int p){
> println "called with $p"
> return "blah: $p"
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)