-
Notifications
You must be signed in to change notification settings - Fork 952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warn ch.qos.logback.classic.Level in Grails 5.1.1 #12291
Comments
The problem with the current implementation is that in Grails® framework applicatio (version 5.1.1), the compilation fails because the class `SoftServiceLoader` will try to initialize LOGGER during compilation and result in `MultipleCompilationErrorsException`. Please check grails/grails-core#12291 for more information. In this commit, we are using `java.util.function.Supplier` instead of directly initializing the LOGGER which will make sure it is initialized after compilation. Fixes #6691 and so grails/grails-core#12291
I think it is happening after updating to Micronaut 3.2.0. I have reported an issue to Micronaut Core and also send a pull-request. |
…ER (#6692) The problem with the current implementation is that in Grails® framework applicatio (version 5.1.1), the compilation fails because the class `SoftServiceLoader` will try to initialize LOGGER during compilation and result in `MultipleCompilationErrorsException`. Please check grails/grails-core#12291 for more information. In this commit, we are using `java.util.function.Supplier` instead of directly initializing the LOGGER which will make sure it is initialized after compilation. Fixes #6691 and so grails/grails-core#12291
I build Grails 5.1.2-SNAPSHORT with latest Micronaut 3.2.4, the DEBUG log already exist!
I add a logger config item below for grails-app/conf/logback.groovy, but there is no effect.
|
StaticOptimizations class initializes Logger at compile time which fails in a Grails application (see grails/grails-core#12291). In this commit, I have wrapped the logic to create Logger with a try-catch block which will return a NOPLogger instance in case of error initializing via LoggerFactory.
* Handle Logger initialization exception with returning NOPLogger StaticOptimizations class initializes Logger at compile time which fails in a Grails application (see grails/grails-core#12291). In this commit, I have wrapped the logic to create Logger with a try-catch block which will return a NOPLogger instance in case of error initializing via LoggerFactory. * Remove logging from StaticOptimizations class * Fix unused imports Co-authored-by: jameskleeh <[email protected]>
This should be resolved with 5.1.2 |
I still seem to be getting this error when running via command line after upgrading to Grails 5.1.2. I don't see the exception if I switch from using logback.groovy to logback.xml. |
I'm also still seeing the issue in Grails 5.1.2 |
Also hit by this issue in 5.1.2 |
@puneetbehl Getting this on 5.1.4 now. Seems the change in #12329 to use Environment.getGrailsVersion() still causes the issue due to the static call to getCurrent() when the class is initialized. The culrpit this time seems to be io.micronaut.context.env.AbstractPropertySourceLoader `> Task :compileTestGroovy Script1.groovy: 2: unable to resolve class grails.util.Environment Script1.groovy: 3: unable to resolve class org.springframework.boot.logging.logback.ColorConverter Script1.groovy: 4: unable to resolve class org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter Script1.groovy: -1: unable to resolve class ch.qos.logback.classic.encoder.PatternLayoutEncoder
` |
I created a complete demo app, and reproduced this issue. It's still in Grails 5.1.7. In this demo app, I downgrade logback to 1.2.8 and use
The same output as above post by @lynchie14 , related commit: #12329
I will submit a PR to fix it. |
FYI, this issue seems to be addressed in Grails 5.1.8. Thanks @rainboyan and @puneetbehl |
Thanks for reporting an issue for Grails framework, please review the task list below before submitting the
issue. Your issue report will be closed if the issue is incomplete and the below tasks not completed.
NOTE: If you are unsure about something and the issue is more of a question a better place to ask questions is on Stack Overflow (http://stackoverflow.com/tags/grails) or Slack (http://slack-signup.grails.org). DO NOT use the issue tracker to ask questions.
Steps to Reproduce
`
$ grails create-app Test5
$ cd Test5
$ ./grailsw create-domain-class People
$ ./grailsw generate-all test5.People
$ ./grailsw test-app
Script1.groovy: 2: unable to resolve class grails.util.Environment
@ line 2, column 1.
import grails.util.Environment
^
Script1.groovy: 3: unable to resolve class org.springframework.boot.logging.logback.ColorConverter
@ line 3, column 1.
import org.springframework.boot.logging.logback.ColorConverter
^
Script1.groovy: 4: unable to resolve class org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter
@ line 4, column 1.
import org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter
^
Script1.groovy: -1: unable to resolve class ch.qos.logback.classic.encoder.PatternLayoutEncoder
@ line -1, column -1.
Script1.groovy: -1: unable to resolve class ch.qos.logback.classic.Level
@ line -1, column -1.
Script1.groovy: -1: unable to resolve class ch.qos.logback.classic.Level
@ line -1, column -1.
Script1.groovy: -1: unable to resolve class ch.qos.logback.classic.Level
@ line -1, column -1.
Script1.groovy: -1: unable to resolve class ch.qos.logback.classic.Level
@ line -1, column -1.
Script1.groovy: -1: unable to resolve class ch.qos.logback.classic.Level
@ line -1, column -1.
Script1.groovy: -1: unable to resolve class ch.qos.logback.classic.Level
@ line -1, column -1.
Script1.groovy: -1: unable to resolve class ch.qos.logback.classic.Level
@ line -1, column -1.
Script1.groovy: -1: unable to resolve class ch.qos.logback.classic.Level
@ line -1, column -1.
13 errors
`
Expected Behaviour
Automated tests ran without warnings.
Actual Behaviour
Some warnings appear
Environment Information
Example Application
https://github.com/fernando88to/Test5
The text was updated successfully, but these errors were encountered: