-
-
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 seesfdxin these docs any more, butsfinstead, which is the new command replacing the oldsfdx. I believe you will still get thesfdxcommand installed together withsf, but in case you don't you can just try replacing thesfdxin the script above withsfand 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
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.