groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-6932) @Log annotation does not check logging enablement inside closures
Date Sun, 28 Aug 2016 12:36:20 GMT

    [ https://issues.apache.org/jira/browse/GROOVY-6932?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15443380#comment-15443380
] 

ASF GitHub Bot commented on GROOVY-6932:
----------------------------------------

GitHub user paulk-asert opened a pull request:

    https://github.com/apache/groovy/pull/401

    GROOVY-6932: @Log annotation does not check logging enablement inside…

    … closures

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/paulk-asert/groovy groovy6932

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/401.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #401
    
----
commit 3a6c2b8586ea4c377581c8a531839ce081a67718
Author: paulk <paulk@asert.com.au>
Date:   2016-08-28T12:33:49Z

    GROOVY-6932: @Log annotation does not check logging enablement inside closures

----


> @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
>            Priority: Minor
>         Attachments: LogAstProblem.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)

Mime
View raw message