Configure logging for the Gretty Gradle Plugin using the SLF4J Logback configuration file (logback-test.xml) from the sample integration test source.
This commit is contained in:
@@ -18,6 +18,7 @@ package io.spring.gradle.convention
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.Task
|
||||
import org.gradle.api.plugins.PluginManager
|
||||
import org.gradle.api.tasks.SourceSetContainer
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
|
||||
/**
|
||||
@@ -40,12 +41,23 @@ class SpringSampleWarPlugin extends SpringSamplePlugin {
|
||||
pluginManager.apply("war")
|
||||
pluginManager.apply("org.gretty")
|
||||
|
||||
def resolvedLogbackConfigFile = new File(project.extensions.getByType(SourceSetContainer)
|
||||
.findByName("integrationTest")?.resources?.filter {
|
||||
"logback-test.xml".equals(it.name)
|
||||
}?.singleFile?.absolutePath)
|
||||
|
||||
// println "Resolved logbackConfigFile [$resolvedLogbackConfigFile]"
|
||||
|
||||
project.gretty {
|
||||
servletContainer = 'tomcat10'
|
||||
contextPath = '/'
|
||||
consoleLogEnabled = false
|
||||
fileLogEnabled = false
|
||||
loggingLevel = 'OFF'
|
||||
|
||||
if (resolvedLogbackConfigFile?.isFile()) {
|
||||
logbackConfigFile = resolvedLogbackConfigFile
|
||||
}
|
||||
}
|
||||
|
||||
Task prepareAppServerForIntegrationTests = project.tasks.create('prepareAppServerForIntegrationTests') {
|
||||
|
||||
Reference in New Issue
Block a user