Each time you run a geoprocessing tool, information about the tool and its parameters is saved. This saved information is referred to as geoprocessing history. This historical information is very useful for determining how data was created and can be used to rerun a process. This historical information is stored in three places:
- The Results window. This is the first place you want to look for a history of what tools you've run and their results.
- A history log file that contains information about each geoprocessing operation. The information contained in the log file is essentially the same as that found in the Results window.
- The metadata of a tool's output data, or to the tool's input data if the tool modifies the input data.
Information about tools run within models is not recorded in the history log file. However, metadata is updated by tools run within models.
For script tools and stand-alone scripts (scripts run outside of an ArcGIS application—from the operating system prompt, for example), history logging is enabled by default. To disable or enable history logging use the SetLogHistory function.
Enabling history logging
To enable the writing of history log files, do the following:
- From the Standard toolbar, click Geoprocessing > Geoprocessing Options.
- Enable (check) the Log geoprocessing operations to a log file check box.
History log files
Where history log files are written
There is one log file for each application (such as ArcMap or ArcCatalog) session. A session is defined by all the work performed from the time you open the application to the time you exit.
On Windows XP, the log files are written to C:\Documents and Settings\<user name>\Application Data\ESRI\Desktop10.2\ArcToolbox\History.
On Windows Vista and Windows 7, the log files are written to C:\Users\<user name>\AppData\(Local or LocalLow or Roaming)\ESRI\Desktop10.2\ArcToolbox\History.
The name of the log file contains the date and time when the application was opened: H<month><day><year>_<hour><minute><second>.xml.
Log file contents
The log file is an Extensible Markup Language (XML) file and is best viewed in an Internet browser such as Internet Explorer. You can drag and drop the file into your browser or, from your browser, click File > Open. The illustration below shows a log file viewed in Internet Explorer.
Information about an individual tool execution is found between the <ResultView> and </ResultView> tags. If you're viewing the log file in a browser, you can collapse and expand tags by clicking the - or a +, as shown below.
The structure and contents within each tag are mostly self-explanatory. Notes about some of the tags follow:
This is the catalog path to the toolbox containing the tool.
The parameter tag has two attributes, Name and Type.
- Label is the label of the parameter as it appears in the tool's dialog box.
- Type contains one of three types:
- Dataset means the value is the catalog path to a dataset on disk.
- Layer means the value is the name of a layer in the ArcMap table of contents. The dataset that the layer references can be found in the <LayerInfo> tag.
- Scalar contains all other values, such as strings, numbers, or linear units.
For every layer used in tool execution, there will be a <Layer> tag in <LayerInfo>. The <Layer> tag has the layer name as an attribute and the catalog path to the dataset used by the layer.
Within the <Environments> tag, there are individual <Environment> tags containing the environment settings during the time of tool execution. Each <Environment> tag has a name attribute containing the environment name and the environment setting. Only environment settings that contain values are listed. That is, there will not be an <Environment> for settings containing blank values.
If there were errors during tool execution, they will be listed here. Internal system errors will be listed here as well, unlike messages written to the progress dialog box or results in the Results window.
Geoprocessing history in Metadata
Each geoprocessing tool that creates new output data or updates the input data will add metadata about the execution of the geoprocessing tool, which includes the tool name, its location, and the parameters used. This behavior can be disabled in desktop applications by un-checking the Log geoprocessing operations to a log file option found in the Geoprocessing > Geoprocessing Options dialog box. In a Python script, logging of geoprocessing history can be disabled using the SetLogHistory function.
Metadata for a dataset is viewed by right-clicking a dataset in the Catalog window or ArcCatalog and choosing Item Description.
After changing the metadata style, you can right-click a dataset and choose Item Description. There will be a section in the Item Description window for geoprocessing.