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

jrmccluskey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new f9449b4365f Log dataflow messages at appropriate levels (#27788)
f9449b4365f is described below

commit f9449b4365ff28f1fd06a631bccc602db61471c7
Author: Jack McCluskey <[email protected]>
AuthorDate: Wed Aug 2 10:05:24 2023 -0400

    Log dataflow messages at appropriate levels (#27788)
    
    * Log dataflow messages at appropriate levels
    
    * Use single-cast message importance for error case
    
    * Add catch-all
---
 .../python/apache_beam/runners/dataflow/dataflow_runner.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/sdks/python/apache_beam/runners/dataflow/dataflow_runner.py 
b/sdks/python/apache_beam/runners/dataflow/dataflow_runner.py
index 668e251ab22..e0a4e4499a2 100644
--- a/sdks/python/apache_beam/runners/dataflow/dataflow_runner.py
+++ b/sdks/python/apache_beam/runners/dataflow/dataflow_runner.py
@@ -197,11 +197,21 @@ class DataflowRunner(PipelineRunner):
           # Skip empty messages.
           if m.messageImportance is None:
             continue
-          _LOGGER.info(message)
-          if str(m.messageImportance) == 'JOB_MESSAGE_ERROR':
+          message_importance = str(m.messageImportance)
+          if (message_importance == 'JOB_MESSAGE_DEBUG' or
+              message_importance == 'JOB_MESSAGE_DETAILED'):
+            _LOGGER.debug(message)
+          elif message_importance == 'JOB_MESSAGE_BASIC':
+            _LOGGER.info(message)
+          elif message_importance == 'JOB_MESSAGE_WARNING':
+            _LOGGER.warning(message)
+          elif message_importance == 'JOB_MESSAGE_ERROR':
+            _LOGGER.error(message)
             if rank_error(m.messageText) >= last_error_rank:
               last_error_rank = rank_error(m.messageText)
               last_error_msg = m.messageText
+          else:
+            _LOGGER.info(message)
         if not page_token:
           break
 

Reply via email to