Fixed logging plugin writing over by default an already copied config.

This commit is contained in:
JesseBrault0709 2024-05-06 20:08:47 +02:00
parent 31c099b6fb
commit d99e28178d
2 changed files with 19 additions and 5 deletions

View File

@ -25,9 +25,10 @@ class GroowtLoggingPlugin implements Plugin<Project> {
javaExtension.sourceSets.each { sourceSet ->
project.tasks.register(
sourceSet.getTaskName('copy', 'LoggingConfig'),
sourceSet.getTaskName('copyLoggingConfigTo', 'Resources'),
GroowtCopyLoggerConfigTask
) { task ->
task.group = 'logging'
task.from(tmpLog4j2Xml)
task.rename { 'log4j2.xml' }
task.into(['src', sourceSet.name, 'resources'].join(File.separator))
@ -45,10 +46,6 @@ class GroowtLoggingPlugin implements Plugin<Project> {
project.dependencies.addProvider(
'runtimeOnly', libs.findLibrary('log4j-slf4jBinding').orElseThrow()
)
project.tasks.named('build') {
it.dependsOn project.tasks.withType(GroowtCopyLoggerConfigTask)
}
}
}

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Configuration xmlns="http://logging.apache.org/log4j/2.0/config">
<Appenders>
<Console name="root">
<PatternLayout>
<LevelPatternSelector defaultPattern="[%t] %-5level %logger{1.} %msg%n">
<PatternMatch key="DEBUG" pattern="[%t] %-5level %logger{1.}.%M() %msg%n"/>
</LevelPatternSelector>
</PatternLayout>
</Console>
</Appenders>
<Loggers>
<Root level="INFO">
<AppenderRef ref="root"/>
</Root>
</Loggers>
</Configuration>