Bring back full arcpy.GetMessages() messages in ArcGIS Pro!

3203
7
05-28-2019 10:10 AM
Status: Implemented
Labels (1)
ChrisSnyder
Regular Contributor III

In Desktop, the arcpy.GetMessages() function generally returned full and useful geoprocessing tool information. However, in Pro (currently at 2.3.3) GetMessages() now generally only returns start/end/elapsed time (!?!?!). ESRI: Please bring back the full geoprocessing message! Many of us record extensive log files for the purposes of debugging and performance monitoring and testing. The messages retuned in Pro now don't even have the tool name any more! As a GIS Programmer/Analyst with 20+ years experience in geoprocessing automation, I find this pretty disappointing.

In Desktop (v10.7 and before)

>>> arcpy.Select_analysis(blah, blah)

>>> arcpy.GetMessages()

Executing: Select E:\lidar_derivatives\processing_data\rs_hydro_processing\fishnet.shp

E:\lidar_derivatives\processing_data\rs_hydro_processing\tile_479\tile_479.gdb\tile_479 "TILE_ID = 479"

Start Time: Sat May 18 09:38:56 2019

Succeeded at Sat May 18 09:38:58 2019 (Elapsed Time: 1.47 seconds)

 

But now in Pro:

>>> arcpy.Select_analysis(blah, blah)

>>> arcpy.GetMessages()

Start Time: Friday, May 24, 2019 2:35:35 PM

Succeeded at Friday, May 24, 2019 2:35:37 PM (Elapsed Time: 1.47 seconds)

7 Comments
HilaryBrowning2

I came here just to write this. Thanks. Having useful logging messages that come directly from the tool is critical. 

by Anonymous User

I completely agree. I have several scripts where geoprocessing tool messages returned are critical as a means to see progress and troubleshoot issues, in addition to standard exception tracking. In cases where this is very important, I find myself writing extra code to provide the user the name of the tool and sometimes the parameters. All of this detailed information used to automatically be returned with the geoprocessing messages. 

MattWilkie1

There is also the result object but using it adds too much scaffolding for my taste. It adds a cognitive load to understanding what a piece of code is actually about. I want to focus on the gp tool, not handling the messages from it.

So instead of:

import arcpy
results = []

results.append(arcpy.SomeTool_toolbox(some_input))
results.append(arcpy.AnotherTool_toolbox(some_input))
results.append(arcpy.DifferentTool_toolbox(some_input))

for result in results:
    print(result.getMessage(result.messageCount-1))

How about something like:

import arcpy
result = results.start_logging()

arcpy.SomeTool_toolbox(some_input)
arcpy.AnotherTool_toolbox(some_input)
arcpy.DifferentTool_toolbox(some_input)

print(result.getMessages()) 

Example found by way of user2856 in arcpy - Using for loop to print last messages from multiple processes? - Geographic Information Syst... 

RandyKreuziger1

Has this been fixed or is there a workaround?  I'm trying to move away from ArcMap to Pro, but there are all these little things that are holding me back.

RonnieRichards

Has this been resolved in anyway? I have been experimenting with the result objects and they seem to have the same problem with the limited output with the start and stop times, same as GetMessages() ?

What would also be helpful are the additional runtime messages from the 10.x tools just like the author posted. It does not seem the result object contains these messages.

Executing: Select E:\lidar_derivatives\processing_data\rs_hydro_processing\fishnet.shp

E:\lidar_derivatives\processing_data\rs_hydro_processing\tile_479\tile_479.gdb\tile_479 "TILE_ID = 479"

HannesZiegler
Status changed to: In Product Plan

We're working on this!

Here's a sample of how this can be accomplished in the future:

HannesZiegler_1-1694722241553.png

Note: The outer 'Start' and 'Succeeded' pertains to the start time from when run is clicked - it includes some geoprocessing framework overhead. The inner 'Start' and 'Succeeded' pertains to the tool's actual execution time.

Release cycles vary by product so make sure to check the product life cycle information to get an idea of when to expect the next release.  

 

HannesZiegler
Status changed to: Implemented

This has been implemented in ArcGIS Pro 3.2 with SetMessageLevels and GetAllMessages. The Result object has an equivalent getAllMessages property.

Please see the What's New documentation for more new features in Pro 3.2. Additionally, we have also posted a Your Ideas in ArcGIS Pro 3.2 blog and video, take a look if interested!