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

mpochatkin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new f5ef55e09b4 IGNITE-28272 Route all logs to stdout on TC (#7810)
f5ef55e09b4 is described below

commit f5ef55e09b4c30a135c608d55d99008b0588c4fa
Author: Vadim Pakhnushev <[email protected]>
AuthorDate: Tue Mar 24 06:01:59 2026 +0300

    IGNITE-28272 Route all logs to stdout on TC (#7810)
---
 .../src/testFixtures/resources/log4j2-runner.xml   | 28 +++++++++++++++-------
 .../src/testFixtures/resources/log4j2-test.xml     | 27 ++++++++++++++-------
 .../internal/network/StaticNodeFinderTest.java     | 10 +++++++-
 3 files changed, 48 insertions(+), 17 deletions(-)

diff --git 
a/modules/compatibility-tests/src/testFixtures/resources/log4j2-runner.xml 
b/modules/compatibility-tests/src/testFixtures/resources/log4j2-runner.xml
index 633521fc3aa..e2454c7cc07 100644
--- a/modules/compatibility-tests/src/testFixtures/resources/log4j2-runner.xml
+++ b/modules/compatibility-tests/src/testFixtures/resources/log4j2-runner.xml
@@ -18,23 +18,35 @@
   -->
 <Configuration>
   <Properties>
-    <!-- Set the `IGNITE_CI` environment variable to completely disable colors 
in the console output. -->
-    <Property name="disableAnsi">${env:IGNITE_CI:-false}</Property>
+    <!-- Set the `IGNITE_CI` environment variable to disable colors and route 
all output to stdout. -->
+    <Property name="ciMode">${env:IGNITE_CI:-false}</Property>
   </Properties>
 
   <Appenders>
     <Console name="CONSOLE" target="SYSTEM_OUT">
       <PatternLayout
         pattern="[%d{ISO8601}]%highlight{[%-5p]}{INFO=green, DEBUG=green bold, 
TRACE=blue}%style{[pid_%pid]}{blue}%style{[%t]}{magenta}%style{[%c{1}]}{cyan} 
%m%n"
-        disableAnsi="${disableAnsi}"/>
+        disableAnsi="${ciMode}"/>
       <LevelRangeFilter minLevel="INFO" maxLevel="TRACE"/>
     </Console>
 
-    <Console name="CONSOLE_ERR" target="SYSTEM_ERR">
-      <PatternLayout
-        pattern="%highlight{[%d{ISO8601}][%-5p][pid_%pid][%t][%c{1}] 
%m}{FATAL=red blink, ERROR=default, WARN=yellow bold}%n"
-        disableAnsi="${disableAnsi}"/>
-    </Console>
+    <!-- On CI (IGNITE_CI=true), route error logs to SYSTEM_OUT instead of 
SYSTEM_ERR to prevent interleaving. -->
+    <Routing name="CONSOLE_ERR">
+      <Routes pattern="${ciMode}">
+        <Route key="true">
+          <Console name="CONSOLE_ERR_OUT" target="SYSTEM_OUT">
+            <PatternLayout
+              pattern="[%d{ISO8601}][%-5p][pid_%pid][%t][%c{1}] %m%n"/>
+          </Console>
+        </Route>
+        <Route>
+          <Console name="CONSOLE_ERR_STDERR" target="SYSTEM_ERR">
+            <PatternLayout
+              pattern="%highlight{[%d{ISO8601}][%-5p][pid_%pid][%t][%c{1}] 
%m}{FATAL=red blink, ERROR=default, WARN=yellow bold}%n"/>
+          </Console>
+        </Route>
+      </Routes>
+    </Routing>
   </Appenders>
 
   <Loggers>
diff --git a/modules/core/src/testFixtures/resources/log4j2-test.xml 
b/modules/core/src/testFixtures/resources/log4j2-test.xml
index b439678291e..09e382c4f9b 100755
--- a/modules/core/src/testFixtures/resources/log4j2-test.xml
+++ b/modules/core/src/testFixtures/resources/log4j2-test.xml
@@ -18,8 +18,8 @@
 -->
 <Configuration>
   <Properties>
-    <!-- Set the `IGNITE_CI` environment variable to completely disable colors 
in the console output. -->
-    <Property name="disableAnsi">${env:IGNITE_CI:-false}</Property>
+    <!-- Set the `IGNITE_CI` environment variable to disable colors and route 
all output to stdout. -->
+    <Property name="ciMode">${env:IGNITE_CI:-false}</Property>
   </Properties>
 
   <Appenders>
@@ -27,7 +27,7 @@
       <PatternLayout>
         <MarkerPatternSelector
           defaultPattern="[%d{ISO8601}]%highlight{[%-5p]}{INFO=green, 
DEBUG=green bold, 
TRACE=blue}%style{[%t]}{magenta}%style{[%c{1}]}{cyan}%notEmpty{[%markerSimpleName]}
 %m%n"
-          disableAnsi="${disableAnsi}">
+          disableAnsi="${ciMode}">
           <!-- Logs from compatibility test runner are already properly 
formatted -->
           <PatternMatch key="CompatRunner" pattern="%m%n"/>
         </MarkerPatternSelector>
@@ -35,11 +35,22 @@
       <LevelRangeFilter minLevel="INFO" maxLevel="DEBUG"/>
     </Console>
 
-    <Console name="CONSOLE_ERR" target="SYSTEM_ERR">
-      <PatternLayout
-        pattern="%highlight{[%d{ISO8601}][%-5p][%t][%c{1}] %m}{FATAL=red 
blink, ERROR=default, WARN=yellow bold}%n"
-        disableAnsi="${disableAnsi}"/>
-    </Console>
+    <!-- On CI (IGNITE_CI=true), route error logs to SYSTEM_OUT instead of 
SYSTEM_ERR to prevent interleaving. -->
+    <Routing name="CONSOLE_ERR">
+      <Routes pattern="${ciMode}">
+        <Route key="true">
+          <Console name="CONSOLE_ERR_OUT" target="SYSTEM_OUT">
+            <!-- Use pattern without ANSI since this pattern is used only with 
ciMode. -->
+            <PatternLayout pattern="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
+          </Console>
+        </Route>
+        <Route>
+          <Console name="CONSOLE_ERR_STDERR" target="SYSTEM_ERR">
+            <PatternLayout pattern="%highlight{[%d{ISO8601}][%-5p][%t][%c{1}] 
%m}{FATAL=red blink, ERROR=default, WARN=yellow bold}%n"/>
+          </Console>
+        </Route>
+      </Routes>
+    </Routing>
 
     <RollingFile name="FILE"
       append="true"
diff --git 
a/modules/network/src/test/java/org/apache/ignite/internal/network/StaticNodeFinderTest.java
 
b/modules/network/src/test/java/org/apache/ignite/internal/network/StaticNodeFinderTest.java
index c6f657a3082..5b2cd628014 100644
--- 
a/modules/network/src/test/java/org/apache/ignite/internal/network/StaticNodeFinderTest.java
+++ 
b/modules/network/src/test/java/org/apache/ignite/internal/network/StaticNodeFinderTest.java
@@ -198,7 +198,9 @@ class StaticNodeFinderTest extends IgniteAbstractTest {
                     + ", stdout: " + stdoutString(process) + ", stderr: " + 
stderrString(process));
         }
 
-        String output = stdoutString(process);
+        // Take only the last line of stdout: log frameworks (e.g. log4j with 
IGNITE_CI=true) may write
+        // warnings to stdout before the actual output produced by 
StaticNodeFinderMain.
+        String output = lastLine(stdoutString(process));
         return Arrays.stream(output.split(","))
                 .map(NetworkAddress::from)
                 .collect(toList());
@@ -221,4 +223,10 @@ class StaticNodeFinderTest extends IgniteAbstractTest {
             return new String(stderr.readAllBytes(), UTF_8);
         }
     }
+
+    private static String lastLine(String text) {
+        String trimmed = text.trim();
+        int lastNewline = trimmed.lastIndexOf('\n');
+        return lastNewline < 0 ? trimmed : trimmed.substring(lastNewline + 
1).trim();
+    }
 }

Reply via email to