Created
August 18, 2020 06:11
-
-
Save michael-adam-sheehan/a2a791bb555d61ae6e9af41e44fb6479 to your computer and use it in GitHub Desktop.
SFDC Errorlog Extract TraceFlag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# initial traceflag setting | |
body = { | |
'StartDate': f"{startDate}", | |
'ExpirationDate': f"{expiryDate}", | |
'ApexCode': 'FINEST', | |
'ApexProfiling': 'FINEST', | |
'Callout': 'FINEST', | |
'Database': 'FINEST', | |
'DebugLevelId': debugLevelId, | |
'System': 'FINE', | |
'TracedEntityId': tracedEntityId, | |
'Validation': 'INFO', | |
'Visualforce': 'FINER', | |
'Workflow': 'FINER', | |
'LogType': 'USER_DEBUG' | |
} | |
traceDebugUrl = f"{self._auth['instanceUrl']}/services/data/v{apiVersion}/tooling/sobjects/TraceFlag" | |
# patch already existing traceflag | |
if traceDebugId: | |
print(f"TraceDebugId defined setting body to expiration date only.") | |
body = {'StartDate': f"{startDate}",'ExpirationDate': f"{expiryDate}"} | |
traceDebugUrl += f"/{traceDebugId}" | |
traceDebugResponse = self._client.request('PATCH', traceDebugUrl, json=body, headers={ | |
'Content-Type': 'application/json'}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment