You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by ja...@apache.org on 2026/05/08 21:57:38 UTC

(grails-core) 01/01: Fix dbmigration test logger config: replace logback.groovy with logback-test.xml

This is an automated email from the ASF dual-hosted git repository.

jamesfredley pushed a commit to branch fix/dbmigration-groovy-change-output
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit 6419aa49ec5b1ee83451f107196a02fb259273aa
Author: James Fredley <ja...@users.noreply.github.com>
AuthorDate: Fri May 8 17:57:23 2026 -0400

    Fix dbmigration test logger config: replace logback.groovy with logback-test.xml
    
    The Groovy joint validation build ("CI - Groovy Joint Validation Build")
    has been failing on the 8.0.x branch since 2026-05-07 with:
    
        GroovyChangeLogSpec > updates a database with Groovy Change FAILED
            Condition not satisfied:
            output.toString().contains('confirmation message')
    
    The captured  output  has the standard Liquibase UI messages
    ('Running Changeset', 'UPDATE SUMMARY', 'Liquibase: Update has been
    successful') but is missing per-changeset log lines that go through
    SLF4J / Logback (e.g. the confirmation message emitted from
    ChangeSet.execute() via  log.info(change.getConfirmationMessage()) ).
    
    Root cause: the previous test logger config was a Groovy-DSL Logback
    config:
    
        appender('STDOUT', ConsoleAppender) {
            withJansi = true
            encoder(PatternLayoutEncoder) {
                pattern = '...%highlight(%p)%cyan(...)...%n'
            }
        }
    
    This relies on (a) the Groovy runtime being on the test JVM classpath
    at Logback init time so Logback's GroovyConfigurator can compile and
    evaluate the script, (b) Jansi for ANSI colour, and (c) the
    %highlight / %cyan converters. In the joint validation environment
    the freshly-built local Groovy snapshot (GROOVY_5_0_X HEAD) interacts
    with Logback's GroovyConfigurator in a way that silently fails to
    register the 'liquibase' logger -> STDOUT binding, so log.info() lines
    go nowhere and the assertion fails.
    
    Replaces  src/test/resources/logback.groovy  with an equivalent
     logback-test.xml  that has no Groovy / Jansi / color-converter
    dependencies. Same logger levels and appender wiring, just XML.
    
    Verified:
    
        ./gradlew :grails-data-hibernate5-dbmigration:test \
            --tests 'org.grails.plugins.databasemigration.liquibase.GroovyChangeLogSpec' \
            -PmaxTestParallel=3 --rerun-tasks
        BUILD SUCCESSFUL in 1m 21s (7 tests, 7 successes, 0 failures, 0 skipped)
    
    Surfaced while auditing PR #15557 (Groovy 5 / Spring Boot 4 upgrade)
    where  build_grails  was the only outstanding Groovy joint validation
    failure on both 8.0.x and the upgrade branch.
    
    Assisted-by: claude-code:claude-opus-4-7
---
 .../src/test/resources/logback-test.xml            | 46 ++++++++++++++++++++++
 .../dbmigration/src/test/resources/logback.groovy  | 38 ------------------
 2 files changed, 46 insertions(+), 38 deletions(-)

diff --git a/grails-data-hibernate5/dbmigration/src/test/resources/logback-test.xml b/grails-data-hibernate5/dbmigration/src/test/resources/logback-test.xml
new file mode 100644
index 0000000000..733e7454d5
--- /dev/null
+++ b/grails-data-hibernate5/dbmigration/src/test/resources/logback-test.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+     Licensed to the Apache Software Foundation (ASF) under one
+     or more contributor license agreements.  See the NOTICE file
+     distributed with this work for additional information
+     regarding copyright ownership.  The ASF licenses this file
+     to you under the Apache License, Version 2.0 (the
+     "License"); you may not use this file except in compliance
+     with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing,
+     software distributed under the License is distributed on an
+     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+     KIND, either express or implied.  See the License for the
+     specific language governing permissions and limitations
+     under the License.
+
+-->
+<configuration>
+
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%t] %p %logger{39} - %m%n</pattern>
+        </encoder>
+    </appender>
+
+    <root level="ERROR">
+        <appender-ref ref="STDOUT"/>
+    </root>
+
+    <logger name="liquibase" level="DEBUG" additivity="false">
+        <appender-ref ref="STDOUT"/>
+    </logger>
+
+    <logger name="org.grails.datastore.gorm.GormEnhancer" level="INFO" additivity="false">
+        <appender-ref ref="STDOUT"/>
+    </logger>
+
+    <logger name="org.grails.plugin.datasource.TomcatJDBCPoolMBeanExporter" level="WARN" additivity="false">
+        <appender-ref ref="STDOUT"/>
+    </logger>
+
+</configuration>
diff --git a/grails-data-hibernate5/dbmigration/src/test/resources/logback.groovy b/grails-data-hibernate5/dbmigration/src/test/resources/logback.groovy
deleted file mode 100644
index f4b25c65a2..0000000000
--- a/grails-data-hibernate5/dbmigration/src/test/resources/logback.groovy
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    https://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-// See http://logback.qos.ch/manual/groovy.html for details on configuration
-def CONSOLE_LOG_PATTERN = '%d{HH:mm:ss.SSS} [%t] %highlight(%p) %cyan(\\(%logger{39}\\)) %m%n'
-
-appender('STDOUT', ConsoleAppender) {
-    withJansi = true
-    encoder(PatternLayoutEncoder) {
-        pattern = CONSOLE_LOG_PATTERN
-    }
-}
-root(ERROR, ['STDOUT'])
-
-//logger("org.grails", DEBUG, ['STDOUT'], false)
-logger("liquibase", DEBUG, ['STDOUT'], false)
-//logger("groovy.sql", DEBUG, ['STDOUT'], false)
-//logger("org.hibernate.SQL", DEBUG, ["STDOUT"], false)
-logger("org.grails.datastore.gorm.GormEnhancer", INFO, ['STDOUT'], false)
-logger("org.grails.plugin.datasource.TomcatJDBCPoolMBeanExporter", WARN, ['STDOUT'], false)
-
-
-