History log files

Each time a tool is executed, whether it is a system, model, or script tool, a record of the execution is written to a history log file. The information contained in the log file is essentially the same as that found in the Results tab of the ArcToolbox window.

Information about tools run within models are not recorded. For script tools and stand-alone scripts (scripts run outside of an ArcGIS application—from the operating system prompt, for example), you can enable history logging using the LogHistory method on the geoprocessing object, as shown in the following Python code snippet:

import arcgisscripting

# Create the Geoprocessor object
gp = arcgisscripting.create(9.3)

# Turn on history logging so that a history log file is written
gp.LogHistory = True

This will log each tool run from within the script.

Enabling history logging

To enable the writing of history log files, you must check (enable) the "Log geoprocessing operations to a log file" option in the geoprocessing settings dialog box, as illustrated below.

Enabling logging

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\ArcToolbox\History

On Windows Vista, the log files are written to:

C:\Users\<user name>\AppData\(Local or LocalLow or Roaming)\ESRI\ArcToolbox\History

The name of the log file contains date and time when the application was opened, as follows:


Log file contents

The log file is a XML (eXtensible Markup Language) file and is best viewed in an internet browser such as Internet Explorer. You can drag/drop the file into your browser, or, from your browser, use Open in the File menu. The illustration below shows a log file viewed in Internet Explorer.

Structure of the history log file

XML data is embedded within tags that add meaning. For example, the command line to execute the tool is found between the <CommandLine> and </CommandLine> tags, as shown below:

<CommandLine>AddField_management Fire_Station UniqueID LONG # # # # NULLABLE NON_REQUIRED #</CommandLine> 

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 is 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.


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 or results in the Results tab.