LogHistory
Summary
The LogHistory class controls whether information about the operation of geoprocessing tools will be written to an external log file.
Discussion
In a script, history logging is activated by default. To disable history logging for a block of code, use the LogHistory class as a function decorator or in a with block as a context manager, and set the log_history parameter to False
The SetLogHistory function can be used to disable history logging for an entire script.
Syntax
LogHistory(log_history)
| Name | Explanation | Data type |
|---|---|---|
|
log_history |
Specifies whether geoprocessing history logging will be enabled and log files created.
|
Boolean |
Code sample
Use the LogHistory class as a context manager,
import arcpy
with arcpy.LogHistory(False):
# Geoprocessing tools run in this context will not be logged in the XML log file
...
Use the LogHistory class as a decorator.
import arcpy
@arcpy.LogHistory(False)
def myFunc(input):
# Geoprocessing tools run in this function will not be logged in the XML log file
...