摘要
LogHistory 类可控制是否将地理处理工具操作的相关信息写入外部日志文件。
说明
在脚本中,默认情况下激活历史记录。 若要禁用代码块的历史日志记录,请将 LogHistory 类用作函数修饰器或在 with 块中用作上下文管理器,并将 log_history 参数设置为 False
该 SetLogHistory 函数可用于禁用整个脚本的历史日志记录。
语法
LogHistory (log_history)
| 参数 | 说明 | 数据类型 |
log_history | Specifies whether geoprocessing history logging will be enabled and log files created.
| Boolean |
代码示例
使用 LogHistory 类作为上下文管理器。
import arcpy
with arcpy.LogHistory(False):
# Geoprocessing tools run in this context will not be logged in the XML log file
...使用 LogHistory 类作为修饰符。
import arcpy
@arcpy.LogHistory(False)
def myFunc(input):
# Geoprocessing tools run in this function will not be logged in the XML log file
...