Franz See
05/29/2019, 2:11 AM@Slf4j
@TestMixin(GrailsUnitTestMixin)
class LoggingSpec extends Specification {
def 'test logging'() {
expect:
println('Testing will start after this...')
log.debug("Calling #someExpensiveMethod() within a GString. ${someExpensiveMethod()}")
<http://log.info|log.info>('should be logged')
println('Testing will end now.')
}
def someExpensiveMethod() {
println('#someExpensiveMethod() was invoked')
return 'Dummy Value'
}
}
Here's the console
Testing will start after this...
#someExpensiveMethod() was invoked
INFO com.crowdLending.LoggingSpec - should be logged
Testing will end now.
Looks like GString conversion still happens even with @Slf4j and even with debug log disabled