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

hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/main by this push:
     new 98dc794e33 Fix pipeline log view mixing logs from other open tabs in 
Hop GUI (#7391)
98dc794e33 is described below

commit 98dc794e3385301af028c479e320adc6e09f13b6
Author: Lance <[email protected]>
AuthorDate: Wed Jul 1 22:24:45 2026 +0800

    Fix pipeline log view mixing logs from other open tabs in Hop GUI (#7391)
    
    Signed-off-by: lance <[email protected]>
---
 .../hop/ui/hopgui/file/pipeline/HopGuiLogBrowser.java | 19 +++++++++++++++----
 .../ui/hopgui/file/pipeline/HopGuiPipelineGraph.java  | 17 +++++++++++++----
 .../pipeline/delegates/HopGuiPipelineLogDelegate.java |  3 +++
 .../workflow/delegates/HopGuiWorkflowLogDelegate.java |  3 +++
 4 files changed, 34 insertions(+), 8 deletions(-)

diff --git 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiLogBrowser.java 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiLogBrowser.java
index 7238a50912..399b5b43d2 100644
--- 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiLogBrowser.java
+++ 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiLogBrowser.java
@@ -64,6 +64,8 @@ public class HopGuiLogBrowser {
   private List<String> childIds = new ArrayList<>();
   private Date lastLogRegistryChange;
   private AtomicBoolean paused;
+  private final AtomicInteger lastLogId = new AtomicInteger(-1);
+  private final AtomicBoolean busy = new AtomicBoolean(false);
 
   public HopGuiLogBrowser(final TextComposite text, final ILogParentProvided 
logProvider) {
     this.text = text;
@@ -75,8 +77,6 @@ public class HopGuiLogBrowser {
 
     // Create a new buffer appender to the log and capture that directly...
     //
-    final AtomicInteger lastLogId = new AtomicInteger(-1);
-    final AtomicBoolean busy = new AtomicBoolean(false);
     final FixedWidthLogLayout logLayout = new FixedWidthLogLayout(true);
 
     // Refresh the log every second or so
@@ -95,7 +95,11 @@ public class HopGuiLogBrowser {
                     () -> {
                       IHasLogChannel provider = 
logProvider.getLogChannelProvider();
 
-                      if (provider != null && !text.isDisposed() && 
!busy.get() && !paused.get()) {
+                      if (provider != null
+                          && !text.isDisposed()
+                          && text.isVisible()
+                          && !busy.get()
+                          && !paused.get()) {
                         busy.set(true);
 
                         ILogChannel logChannel = provider.getLogChannel();
@@ -120,9 +124,11 @@ public class HopGuiLogBrowser {
                           //
                           int lastNr = HopLogStore.getLastBufferLineNr();
                           if (lastNr > lastLogId.get()) {
+                            // Only show logs for this pipeline/workflow and 
its children, not the
+                            // shared Hop GUI log channel (which would mix 
logs from other tabs).
                             List<HopLoggingEvent> logLines =
                                 HopLogStore.getLogBufferFromTo(
-                                    childIds, true, lastLogId.get(), lastNr);
+                                    childIds, false, lastLogId.get(), lastNr);
 
                             // The maximum size of the log buffer
                             //
@@ -283,4 +289,9 @@ public class HopGuiLogBrowser {
     childIds = new ArrayList<>();
     lastLogRegistryChange = null;
   }
+
+  /** Skip log lines already in the central buffer (e.g. after the user clears 
the log view). */
+  public void resetLogPosition() {
+    lastLogId.set(HopLogStore.getLastBufferLineNr());
+  }
 }
diff --git 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
index 601e29dddd..09f1ab2072 100644
--- 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
+++ 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
@@ -5139,8 +5139,11 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
 
             initialized = true;
           } catch (HopException e) {
-            log.logError(
-                pipeline.getPipelineMeta().getName() + ": preparing pipeline 
execution failed", e);
+            pipeline
+                .getLogChannel()
+                .logError(
+                    pipeline.getPipelineMeta().getName() + ": preparing 
pipeline execution failed",
+                    e);
             checkErrorVisuals();
           }
 
@@ -5184,7 +5187,9 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
                               pipeline.startThreads();
                               pipeline.waitUntilFinished();
                             } catch (Exception e) {
-                              log.logError("Error starting transform threads", 
e);
+                              pipeline
+                                  .getLogChannel()
+                                  .logError("Error starting transform 
threads", e);
                               checkErrorVisuals();
                               stopRedrawTimer();
                             }
@@ -5195,7 +5200,11 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
 
       updateGui();
     } catch (Exception e) {
-      log.logError("Error starting transform threads", e);
+      if (pipeline != null) {
+        pipeline.getLogChannel().logError("Error starting transform threads", 
e);
+      } else {
+        log.logError("Error starting transform threads", e);
+      }
       checkErrorVisuals();
       stopRedrawTimer();
     }
diff --git 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/delegates/HopGuiPipelineLogDelegate.java
 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/delegates/HopGuiPipelineLogDelegate.java
index 5b0bbc7a6b..fc91168e51 100644
--- 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/delegates/HopGuiPipelineLogDelegate.java
+++ 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/delegates/HopGuiPipelineLogDelegate.java
@@ -221,6 +221,9 @@ public class HopGuiPipelineLogDelegate {
       String textToSet = OsHelper.isMac() ? Const.CR : "";
       pipelineLogText.setText(textToSet);
     }
+    if (logBrowser != null) {
+      logBrowser.resetLogPosition();
+    }
     Map<String, String> transformLogMap = pipelineGraph.getTransformLogMap();
     if (transformLogMap != null) {
       transformLogMap.clear();
diff --git 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/delegates/HopGuiWorkflowLogDelegate.java
 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/delegates/HopGuiWorkflowLogDelegate.java
index 1a06cceadc..e551464a0b 100644
--- 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/delegates/HopGuiWorkflowLogDelegate.java
+++ 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/delegates/HopGuiWorkflowLogDelegate.java
@@ -212,6 +212,9 @@ public class HopGuiWorkflowLogDelegate {
       String textToSet = OsHelper.isMac() ? Const.CR : "";
       workflowLogText.setText(textToSet);
     }
+    if (logBrowser != null) {
+      logBrowser.resetLogPosition();
+    }
   }
 
   @GuiToolbarElement(

Reply via email to