I mix Groovy and Java in my Spring-boot application. Break controllers and data access are written to Groovy. The configurations are mostly in Java.
According to the log documentation, if the logback.groovy file is in the classpath, it must be selected before logback.xml. However, in my case only logback.xml works.
I run the application as a sprint-boot application.
In addition, it is worth noting that spring offers to inherit some logging configuration, as shown below.
<configuration> <include resource="org/springframework/boot/logging/logback/base.xml"/> <logger name="org.springframework.web" level="DEBUG"/> </configuration>
There is no way to do this in Groovy config.
build.gradle:
dependencies { compile("org.springframework.boot:spring-boot-starter-web") compile("org.springframework:spring-jdbc") compile("com.h2database:h2") compile("org.hsqldb:hsqldb") testCompile("junit:junit") compile('org.codehaus.groovy:groovy-all:2.3.10') testCompile('org.codehaus.groovy.modules.http-builder:http-builder:0.5.0-RC2') compile('org.slf4j:slf4j-simple:1.6.1') } sourceSets { main { groovy { srcDirs = ['src/main/groovy', 'src/main/java'] } java { srcDirs = [] } } test { groovy { srcDirs = ['src/test/groovy', 'src/test/java'] } java { srcDirs = [] } } }
spring-boot groovy logback logback-groovy
sreehari
source share