Skip to content

Instantly share code, notes, and snippets.

@prakharxagrawal
Last active April 30, 2024 02:12
Show Gist options
  • Save prakharxagrawal/416dfa0fe8621c543ff4097474eb937e to your computer and use it in GitHub Desktop.
Save prakharxagrawal/416dfa0fe8621c543ff4097474eb937e to your computer and use it in GitHub Desktop.
This Gist has Script to download Debug Logs as a Bulk Jub from Salesforce.
rem I have modified this Script from a bash script to a Batch Script
rem the modified Bash Script for this was created by roko-p
rem Here is the Git URL for Bash Script Using SFDX-CLI
rem https://gist.github.com/roko-p/d5d519c1cb4addfdd4644fd11c0aaa02
rem Below are the comments by roko-p
rem This Original is a script by Thomas Gagné posted here:
rem https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A8irTSAR
rem but modified to use the `sfdx` CLI tool instead
rem of the `force` CLI tool.
rem Just add the username
rem (to specify which org to run this against) to both
rem sfdx commands with `-u your.username@whatever.com`
rem Original comments below:
rem script for export ALL debug logs to a subdirectory
rem named "log".
rem it requires the "force" CLI tool be available and
rem assumes the user is already logged in.
rem Sure, I could have added more debugging, like checking
rem to see if the user was logged in, but I didn't have
rem all night. ;-)
rem 2017-08-29 tggagne@gmail.com
@echo off
for /f "delims=" %%f in ('sfdx force:data:soql:query -u <username> -q "select id from apexlog"') do (
echo "writing log/%%f.log"
sfdx force:apex:log:get -u <username> --logid %%f > log/%%f.log
)
@echo on
echo Log Download Completed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment