[ 
https://issues.apache.org/jira/browse/GROOVY-10748?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul King resolved GROOVY-10748.
--------------------------------
    Fix Version/s: 4.0.5
         Assignee: Paul King
       Resolution: Fixed

This should be fixed in the next release. Thanks for spotting the issue.

> logback-classic 1.3.0 and 1.4.0 breaks on Groovy
> ------------------------------------------------
>
>                 Key: GROOVY-10748
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10748
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 4.0.4
>            Reporter: Ramesh Venkitaswaran
>            Assignee: Paul King
>            Priority: Minor
>             Fix For: 4.0.5
>
>
> Logging is not working when using logback version 1.3.0 or 1.4.0. The slf4j 
> version is 2.0.0. This error is emitted.
> {noformat}
> SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
> SLF4J: Defaulting to no-operation (NOP) logger implementation
> SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further 
> details.
> {noformat}
> I searched the logback-user mailing lists and found a thread on Sep 1 and it 
> had a link to this github issue for Spring 
> ([https://github.com/spring-projects/spring-boot/issues/12649]) which also 
> has a similar issue. The link to the thread is here 
> ([http://mailman.qos.ch/pipermail/logback-user/2022-September/005231.html])
> Test logback.xml
> {code:xml}
> <configuration>
>   <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
>     <encoder>
>       <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - 
> %msg%n</pattern>
>     </encoder>
>   </appender>
>   <root level="debug">
>     <appender-ref ref="STDOUT"/>
>   </root>
> </configuration>
> {code}
> Sample groovy test code. Changing version 1.3.0 to 1.2.11 will work. Also 
> tested with 1.4.0 and it does not work.
> {code:groovy}
> @Grab('org.slf4j:slf4j-api:2.0.0')
> @Grab('ch.qos.logback:logback-classic:1.3.0')
> import org.slf4j.*
> import groovy.util.logging.*
> @Slf4j(category="hello")
> class Hello {
>     def useLogger() {
>         log.info 'logging works'
>         log.debug 'debugging!!!'
>     }
> }
> new Hello().useLogger()
> {code}
> To run:
> {noformat}
> groovy -Dlogback.configurationFile=/path/to/logback.xml /path/to/script.groovy
> {noformat}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to