SetLogHistory

摘要

控制是否将地理处理工具操作的相关信息写入外部日志文件。

说明

在脚本中,默认情况下启用历史记录。 要禁用历史记录,请使用 arcpy.SetLogHistory(False)

要限制历史记录的持续时间,请将 LogHistory 类用作上下文管理器或修饰符。

要控制是否更新地理处理工具输入和输出数据集元数据,请使用 SetLogMetadata 函数。

语法

SetLogHistory (log_history)
参数说明数据类型
log_history

Specifies whether geoprocessing history logging is enabled.

  • True—Geoprocessing history logging is enabled, and .xml log files will be created in the %AppData%\Esri\ArcGISPro\ArcToolbox\History directory.
  • False—Geoprocessing history logging is not enabled, and .xml log files will not be created.
Boolean

代码示例

SetLogHistory 示例

如果启用,则禁用历史记录。

import arcpy
if arcpy.GetLogHistory():
    arcpy.SetLogHistory(False)

相关主题


在本主题中