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 1d38a843eb log level is not correctly passed to remote server, fixes 
#3173 (#7546)
1d38a843eb is described below

commit 1d38a843eb458d84fdb772a8a78468e77a475474
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Thu Jul 16 22:13:01 2026 +0200

    log level is not correctly passed to remote server, fixes #3173 (#7546)
---
 .../hop/workflow/engine/WorkflowEngineFactory.java |   3 +
 .../org/apache/hop/www/BaseWorkflowServlet.java    |   1 +
 .../workflow/engine/WorkflowEngineFactoryTest.java | 106 +++++++++++++++++++++
 integration-tests/hop_server/0011-loglevel.hpl     | 101 ++++++++++++++++++++
 .../hop_server/0012-loglevel-workflow.hwf          |  80 ++++++++++++++++
 .../hop_server/main-0011-test-remote-loglevel.hwf  |  94 ++++++++++++++++++
 .../main-0012-test-remote-loglevel-workflow.hwf    |  94 ++++++++++++++++++
 .../pipeline-run-configuration/remote.json         |   7 +-
 8 files changed, 484 insertions(+), 2 deletions(-)

diff --git 
a/engine/src/main/java/org/apache/hop/workflow/engine/WorkflowEngineFactory.java
 
b/engine/src/main/java/org/apache/hop/workflow/engine/WorkflowEngineFactory.java
index fdac2b6bc2..03f7ac8a63 100644
--- 
a/engine/src/main/java/org/apache/hop/workflow/engine/WorkflowEngineFactory.java
+++ 
b/engine/src/main/java/org/apache/hop/workflow/engine/WorkflowEngineFactory.java
@@ -28,6 +28,7 @@ import org.apache.hop.workflow.WorkflowMeta;
 import org.apache.hop.workflow.config.IWorkflowEngineRunConfiguration;
 import org.apache.hop.workflow.config.WorkflowRunConfiguration;
 import org.apache.hop.workflow.engines.local.LocalWorkflowEngine;
+import org.apache.hop.workflow.engines.remote.RemoteWorkflowEngine;
 
 public class WorkflowEngineFactory {
 
@@ -106,6 +107,8 @@ public class WorkflowEngineFactory {
 
     if (workflowEngine instanceof LocalWorkflowEngine localWorkflowEngine) {
       localWorkflowEngine.setParentLoggingObject(parentLogging);
+    } else if (workflowEngine instanceof RemoteWorkflowEngine 
remoteWorkflowEngine) {
+      remoteWorkflowEngine.setParentLoggingObject(parentLogging);
     }
     workflowEngine.setWorkflowMeta(workflowMeta);
 
diff --git a/engine/src/main/java/org/apache/hop/www/BaseWorkflowServlet.java 
b/engine/src/main/java/org/apache/hop/www/BaseWorkflowServlet.java
index e6752aeb77..603d1a022e 100644
--- a/engine/src/main/java/org/apache/hop/www/BaseWorkflowServlet.java
+++ b/engine/src/main/java/org/apache/hop/www/BaseWorkflowServlet.java
@@ -125,6 +125,7 @@ public abstract class BaseWorkflowServlet extends 
BodyHttpServlet {
             variables, variables.resolve(runConfigurationName), 
metadataProvider, pipelineMeta);
     pipeline.setParent(servletLoggingObject);
     pipeline.setMetadataProvider(metadataProvider);
+    pipeline.setLogLevel(pipelineExecutionConfiguration.getLogLevel());
 
     // Also copy the parameters over...
     copyParameters(pipeline, 
pipelineExecutionConfiguration.getParametersMap());
diff --git 
a/engine/src/test/java/org/apache/hop/workflow/engine/WorkflowEngineFactoryTest.java
 
b/engine/src/test/java/org/apache/hop/workflow/engine/WorkflowEngineFactoryTest.java
new file mode 100644
index 0000000000..fbc52080af
--- /dev/null
+++ 
b/engine/src/test/java/org/apache/hop/workflow/engine/WorkflowEngineFactoryTest.java
@@ -0,0 +1,106 @@
+/*
+ * 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.
+ */
+
+package org.apache.hop.workflow.engine;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertSame;
+
+import org.apache.hop.core.HopEnvironment;
+import org.apache.hop.core.exception.HopException;
+import org.apache.hop.core.logging.LogLevel;
+import org.apache.hop.core.logging.LoggingObjectType;
+import org.apache.hop.core.logging.SimpleLoggingObject;
+import org.apache.hop.core.variables.Variables;
+import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider;
+import org.apache.hop.workflow.WorkflowMeta;
+import org.apache.hop.workflow.config.IWorkflowEngineRunConfiguration;
+import org.apache.hop.workflow.config.WorkflowRunConfiguration;
+import org.apache.hop.workflow.engines.local.LocalWorkflowEngine;
+import org.apache.hop.workflow.engines.local.LocalWorkflowRunConfiguration;
+import org.apache.hop.workflow.engines.remote.RemoteWorkflowEngine;
+import org.apache.hop.workflow.engines.remote.RemoteWorkflowRunConfiguration;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+class WorkflowEngineFactoryTest {
+
+  @BeforeAll
+  static void setUpBeforeClass() throws HopException {
+    HopEnvironment.init();
+  }
+
+  /**
+   * The parent logging object is how the log level is pushed down into the 
engine. A workflow that
+   * runs on a server needs it as much as one that runs locally, or the server 
ends up logging at
+   * Basic whatever level was asked for. See issue #3173.
+   */
+  @Test
+  void remoteEngineKeepsTheParentLoggingObject() throws Exception {
+    SimpleLoggingObject parent = createParent();
+
+    RemoteWorkflowEngine engine =
+        assertInstanceOf(
+            RemoteWorkflowEngine.class,
+            createEngine("Remote", new RemoteWorkflowRunConfiguration(), 
parent));
+
+    assertSame(parent, engine.getParent());
+    assertEquals(LogLevel.DEBUG, engine.getParent().getLogLevel());
+  }
+
+  /** The local engine has always been given the parent, this makes sure it 
keeps it. */
+  @Test
+  void localEngineKeepsTheParentLoggingObject() throws Exception {
+    SimpleLoggingObject parent = createParent();
+
+    LocalWorkflowEngine engine =
+        assertInstanceOf(
+            LocalWorkflowEngine.class,
+            createEngine("Local", new LocalWorkflowRunConfiguration(), 
parent));
+
+    assertSame(parent, engine.getParent());
+  }
+
+  private SimpleLoggingObject createParent() {
+    SimpleLoggingObject parent =
+        new SimpleLoggingObject("a-parent", LoggingObjectType.HOP_GUI, null);
+    parent.setLogLevel(LogLevel.DEBUG);
+    return parent;
+  }
+
+  /**
+   * @param enginePluginId the id of the workflow engine plugin to run with, 
normally filled in when
+   *     the run configuration is read from its metadata
+   */
+  private IWorkflowEngine<WorkflowMeta> createEngine(
+      String enginePluginId,
+      IWorkflowEngineRunConfiguration engineRunConfiguration,
+      SimpleLoggingObject parent)
+      throws HopException {
+    engineRunConfiguration.setEnginePluginId(enginePluginId);
+
+    String name = "a-" + enginePluginId + "-run-configuration";
+    MemoryMetadataProvider metadataProvider = new MemoryMetadataProvider();
+    metadataProvider
+        .getSerializer(WorkflowRunConfiguration.class)
+        .save(new WorkflowRunConfiguration(name, "", null, 
engineRunConfiguration, false));
+
+    return WorkflowEngineFactory.createWorkflowEngine(
+        new Variables(), name, metadataProvider, new WorkflowMeta(), parent);
+  }
+}
diff --git a/integration-tests/hop_server/0011-loglevel.hpl 
b/integration-tests/hop_server/0011-loglevel.hpl
new file mode 100644
index 0000000000..669771c4c2
--- /dev/null
+++ b/integration-tests/hop_server/0011-loglevel.hpl
@@ -0,0 +1,101 @@
+<?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.
+
+-->
+<pipeline>
+  <info>
+    <name>0011-loglevel</name>
+    <name_sync_with_filename>Y</name_sync_with_filename>
+    <description>Writes a message to the log at the Debug level. When this 
pipeline is executed on a
+      server with a Debug log level, the message shows up in the log of that 
server. When the log
+      level is not carried over to the server, the server runs at Basic and 
swallows the message.
+      See issue #3173.</description>
+    <extended_description/>
+    <pipeline_version/>
+    <pipeline_type>Normal</pipeline_type>
+    <parameters>
+    </parameters>
+    <capture_transform_performance>N</capture_transform_performance>
+    
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
+    
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
+    <created_user>-</created_user>
+    <created_date>2024/01/01 00:00:00.000</created_date>
+    <modified_user>-</modified_user>
+    <modified_date>2024/01/01 00:00:00.000</modified_date>
+  </info>
+  <notepads>
+  </notepads>
+  <order>
+    <hop>
+      <from>Generate a row</from>
+      <to>Write debug message</to>
+      <enabled>Y</enabled>
+    </hop>
+  </order>
+  <transform>
+    <name>Generate a row</name>
+    <type>RowGenerator</type>
+    <description/>
+    <distribute>Y</distribute>
+    <custom_distribution/>
+    <copies>1</copies>
+    <partitioning>
+      <method>none</method>
+      <schema_name/>
+    </partitioning>
+    <fields>
+</fields>
+    <interval_in_ms>5000</interval_in_ms>
+    <last_time_field/>
+    <never_ending>N</never_ending>
+    <limit>1</limit>
+    <row_time_field/>
+    <attributes/>
+    <GUI>
+      <xloc>48</xloc>
+      <yloc>80</yloc>
+    </GUI>
+  </transform>
+  <transform>
+    <name>Write debug message</name>
+    <type>WriteToLog</type>
+    <description/>
+    <distribute>Y</distribute>
+    <custom_distribution/>
+    <copies>1</copies>
+    <partitioning>
+      <method>none</method>
+      <schema_name/>
+    </partitioning>
+    <displayHeader>N</displayHeader>
+    <fields>
+</fields>
+    <limitRows>N</limitRows>
+    <limitRowsNumber>0</limitRowsNumber>
+    <loglevel>Debug</loglevel>
+    <logmessage>LOGLEVEL-MARKER-3173</logmessage>
+    <attributes/>
+    <GUI>
+      <xloc>224</xloc>
+      <yloc>80</yloc>
+    </GUI>
+  </transform>
+  <transform_error_handling>
+  </transform_error_handling>
+  <attributes/>
+</pipeline>
diff --git a/integration-tests/hop_server/0012-loglevel-workflow.hwf 
b/integration-tests/hop_server/0012-loglevel-workflow.hwf
new file mode 100644
index 0000000000..9cbb17326f
--- /dev/null
+++ b/integration-tests/hop_server/0012-loglevel-workflow.hwf
@@ -0,0 +1,80 @@
+<?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.
+
+-->
+<workflow>
+  <name>0012-loglevel-workflow</name>
+  <name_sync_with_filename>Y</name_sync_with_filename>
+  <description>Writes a message to the log at the Debug level. When this 
workflow is executed on a
+    server with a Debug log level, the message shows up in the log of that 
server. When the log
+    level is not carried over to the server, the server runs at Basic and 
swallows the message.
+    See issue #3173.</description>
+  <extended_description/>
+  <workflow_version/>
+  <created_user>-</created_user>
+  <created_date>2024/01/01 00:00:00.000</created_date>
+  <modified_user>-</modified_user>
+  <modified_date>2024/01/01 00:00:00.000</modified_date>
+  <parameters>
+    </parameters>
+  <actions>
+    <action>
+      <name>Start</name>
+      <description/>
+      <type>SPECIAL</type>
+      <attributes/>
+      <DayOfMonth>1</DayOfMonth>
+      <hour>12</hour>
+      <intervalMinutes>60</intervalMinutes>
+      <intervalSeconds>0</intervalSeconds>
+      <minutes>0</minutes>
+      <repeat>N</repeat>
+      <schedulerType>0</schedulerType>
+      <weekDay>1</weekDay>
+      <parallel>N</parallel>
+      <xloc>50</xloc>
+      <yloc>50</yloc>
+      <attributes_hac/>
+    </action>
+    <action>
+      <name>Write debug message</name>
+      <description/>
+      <type>WRITE_TO_LOG</type>
+      <attributes/>
+      <loglevel>Debug</loglevel>
+      <logmessage>LOGLEVEL-MARKER-3173-WORKFLOW</logmessage>
+      <logsubject/>
+      <parallel>N</parallel>
+      <xloc>250</xloc>
+      <yloc>50</yloc>
+      <attributes_hac/>
+    </action>
+  </actions>
+  <hops>
+    <hop>
+      <from>Start</from>
+      <to>Write debug message</to>
+      <enabled>Y</enabled>
+      <evaluation>Y</evaluation>
+      <unconditional>Y</unconditional>
+    </hop>
+  </hops>
+  <notepads>
+  </notepads>
+  <attributes/>
+</workflow>
diff --git a/integration-tests/hop_server/main-0011-test-remote-loglevel.hwf 
b/integration-tests/hop_server/main-0011-test-remote-loglevel.hwf
new file mode 100644
index 0000000000..60aeffae0f
--- /dev/null
+++ b/integration-tests/hop_server/main-0011-test-remote-loglevel.hwf
@@ -0,0 +1,94 @@
+<?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.
+
+-->
+<workflow>
+  <name>main-0011-test-remote-loglevel</name>
+  <name_sync_with_filename>Y</name_sync_with_filename>
+  <description>Runs a pipeline on a server with a Debug log level. The 
pipeline writes a message to
+    the log at that level, so the message only shows up when the log level 
reaches the server.
+    See issue #3173.</description>
+  <extended_description/>
+  <workflow_version/>
+  <created_user>-</created_user>
+  <created_date>2024/01/01 00:00:00.000</created_date>
+  <modified_user>-</modified_user>
+  <modified_date>2024/01/01 00:00:00.000</modified_date>
+  <parameters>
+    </parameters>
+  <actions>
+    <action>
+      <name>Start</name>
+      <description/>
+      <type>SPECIAL</type>
+      <attributes/>
+      <DayOfMonth>1</DayOfMonth>
+      <hour>12</hour>
+      <intervalMinutes>60</intervalMinutes>
+      <intervalSeconds>0</intervalSeconds>
+      <minutes>0</minutes>
+      <repeat>N</repeat>
+      <schedulerType>0</schedulerType>
+      <weekDay>1</weekDay>
+      <parallel>N</parallel>
+      <xloc>50</xloc>
+      <yloc>50</yloc>
+      <attributes_hac/>
+    </action>
+    <action>
+      <name>Run loglevel pipeline on server</name>
+      <description/>
+      <type>PIPELINE</type>
+      <attributes/>
+      <filename>${PROJECT_HOME}/0011-loglevel.hpl</filename>
+      <params_from_previous>N</params_from_previous>
+      <exec_per_row>N</exec_per_row>
+      <clear_rows>N</clear_rows>
+      <clear_files>N</clear_files>
+      <set_logfile>N</set_logfile>
+      <logfile/>
+      <logext/>
+      <add_date>N</add_date>
+      <add_time>N</add_time>
+      <loglevel>Debug</loglevel>
+      <set_append_logfile>N</set_append_logfile>
+      <wait_until_finished>Y</wait_until_finished>
+      <create_parent_folder>N</create_parent_folder>
+      <run_configuration>remote</run_configuration>
+      <parameters>
+        <pass_all_parameters>Y</pass_all_parameters>
+      </parameters>
+      <parallel>N</parallel>
+      <xloc>250</xloc>
+      <yloc>50</yloc>
+      <attributes_hac/>
+    </action>
+  </actions>
+  <hops>
+    <hop>
+      <from>Start</from>
+      <to>Run loglevel pipeline on server</to>
+      <enabled>Y</enabled>
+      <evaluation>Y</evaluation>
+      <unconditional>Y</unconditional>
+    </hop>
+  </hops>
+  <notepads>
+  </notepads>
+  <attributes/>
+</workflow>
diff --git 
a/integration-tests/hop_server/main-0012-test-remote-loglevel-workflow.hwf 
b/integration-tests/hop_server/main-0012-test-remote-loglevel-workflow.hwf
new file mode 100644
index 0000000000..8dff1ad7b0
--- /dev/null
+++ b/integration-tests/hop_server/main-0012-test-remote-loglevel-workflow.hwf
@@ -0,0 +1,94 @@
+<?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.
+
+-->
+<workflow>
+  <name>main-0012-test-remote-loglevel-workflow</name>
+  <name_sync_with_filename>Y</name_sync_with_filename>
+  <description>Runs a workflow on a server with a Debug log level. The 
workflow writes a message to
+    the log at that level, so the message only shows up when the log level 
reaches the server.
+    See issue #3173.</description>
+  <extended_description/>
+  <workflow_version/>
+  <created_user>-</created_user>
+  <created_date>2024/01/01 00:00:00.000</created_date>
+  <modified_user>-</modified_user>
+  <modified_date>2024/01/01 00:00:00.000</modified_date>
+  <parameters>
+    </parameters>
+  <actions>
+    <action>
+      <name>Start</name>
+      <description/>
+      <type>SPECIAL</type>
+      <attributes/>
+      <DayOfMonth>1</DayOfMonth>
+      <hour>12</hour>
+      <intervalMinutes>60</intervalMinutes>
+      <intervalSeconds>0</intervalSeconds>
+      <minutes>0</minutes>
+      <repeat>N</repeat>
+      <schedulerType>0</schedulerType>
+      <weekDay>1</weekDay>
+      <parallel>N</parallel>
+      <xloc>50</xloc>
+      <yloc>50</yloc>
+      <attributes_hac/>
+    </action>
+    <action>
+      <name>Run loglevel workflow on server</name>
+      <description/>
+      <type>WORKFLOW</type>
+      <attributes/>
+      <filename>${PROJECT_HOME}/0012-loglevel-workflow.hwf</filename>
+      <params_from_previous>N</params_from_previous>
+      <exec_per_row>N</exec_per_row>
+      <clear_rows>N</clear_rows>
+      <clear_files>N</clear_files>
+      <set_logfile>N</set_logfile>
+      <logfile/>
+      <logext/>
+      <add_date>N</add_date>
+      <add_time>N</add_time>
+      <loglevel>Debug</loglevel>
+      <set_append_logfile>N</set_append_logfile>
+      <wait_until_finished>Y</wait_until_finished>
+      <create_parent_folder>N</create_parent_folder>
+      <run_configuration>remote</run_configuration>
+      <parameters>
+        <pass_all_parameters>Y</pass_all_parameters>
+      </parameters>
+      <parallel>N</parallel>
+      <xloc>250</xloc>
+      <yloc>50</yloc>
+      <attributes_hac/>
+    </action>
+  </actions>
+  <hops>
+    <hop>
+      <from>Start</from>
+      <to>Run loglevel workflow on server</to>
+      <enabled>Y</enabled>
+      <evaluation>Y</evaluation>
+      <unconditional>Y</unconditional>
+    </hop>
+  </hops>
+  <notepads>
+  </notepads>
+  <attributes/>
+</workflow>
diff --git 
a/integration-tests/hop_server/metadata/pipeline-run-configuration/remote.json 
b/integration-tests/hop_server/metadata/pipeline-run-configuration/remote.json
index f9d2a760a3..9ca2e6dd2b 100644
--- 
a/integration-tests/hop_server/metadata/pipeline-run-configuration/remote.json
+++ 
b/integration-tests/hop_server/metadata/pipeline-run-configuration/remote.json
@@ -4,13 +4,16 @@
       "export_resources": true,
       "resources_target_folder": "",
       "resources_source_folder": "",
+      "run_config": "local",
       "server_poll_interval": "",
-      "run_config": "",
       "hop_server": "testserver",
       "server_poll_delay": ""
     }
   },
+  "defaultSelection": false,
   "configurationVariables": [],
   "name": "remote",
-  "description": ""
+  "description": "",
+  "dataProfile": "",
+  "executionInfoLocationName": ""
 }
\ No newline at end of file

Reply via email to