-
-
Save roko-p/d5d519c1cb4addfdd4644fd11c0aaa02 to your computer and use it in GitHub Desktop.
#!/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 |
I am getting:
line 1: sfdx: command not found
@prakharxagrawal you need to have the Salesforce CLI installed first: How to.
(You probably won't see sfdx
in these docs any more, but sf
instead, which is the new command replacing the old sfdx
. I believe you will still get the sfdx
command installed together with sf
, but in case you don't you can just try replacing the sfdx
in the script above with sf
and everything should still work.)
I am getting:
line 1: sfdx: command not found@prakharxagrawal you need to have the Salesforce CLI installed first: How to.
(You probably won't see
sfdx
in these docs any more, butsf
instead, which is the new command replacing the oldsfdx
. I believe you will still get thesfdx
command installed together withsf
, but in case you don't you can just try replacing thesfdx
in the script above withsf
and everything should still work.)
Hi @roko-p, I Have SFDX installed on my system, I have tried running it on VS Code Terminal, Bash Terminal, Command Prompt, everywher. I get the same error, Additionally, I am able to run both SFDX Commands individually that are inside for loop.
I am getting:
line 1: sfdx: command not found@prakharxagrawal you need to have the Salesforce CLI installed first: How to.
(You probably won't seesfdx
in these docs any more, butsf
instead, which is the new command replacing the oldsfdx
. I believe you will still get thesfdx
command installed together withsf
, but in case you don't you can just try replacing thesfdx
in the script above withsf
and everything should still work.)Hi @roko-p, I Have SFDX installed on my system, I have tried running it on VS Code Terminal, Bash Terminal, Command Prompt, everywher. I get the same error, Additionally, I am able to run both SFDX Commands individually that are inside for loop.
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
I am getting:
line 1: sfdx: command not found