Created
August 15, 2021 13:32
-
-
Save roko-p/d5d519c1cb4addfdd4644fd11c0aaa02 to your computer and use it in GitHub Desktop.
Download all debug logs from a Salesforce org
This file contains hidden or 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
#!/bin/bash | |
# This is a script by Thomas Gagné posted here: | |
# https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A8irTSAR | |
# but modified to use the `sfdx` CLI tool instead | |
# of the `force` CLI tool. | |
# This assumes the user is logged in and the default | |
# org is set. If you're running this outside of a | |
# Salesforce DX project folder, just add the username | |
# (to specify which org to run this against) to both | |
# sfdx commands with `-u [email protected]` | |
# Original comments below: | |
# script for export ALL debug logs to a subdirectory | |
# named "log". | |
# | |
# it requires the "force" CLI tool be available and | |
# assumes the user is already logged in. | |
# | |
# Sure, I could have added more debugging, like checking | |
# to see if the user was logged in, but I didn't have | |
# all night. ;-) | |
# | |
# 2017-08-29 [email protected] | |
for logId in $(sfdx force:data:soql:query -q "select id from apexlog" | tail -n +3); do | |
echo "writing log/$logId.debug" | |
sfdx force:apex:log:get --logid $logId > log/$logId.debug | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @roko-p, I modified this to batch script and it worked for me, Thanks again :), Here's my modified script
https://gist.github.com/prakharxagrawal/416dfa0fe8621c543ff4097474eb937e