Use logging tools in the Salesforce CLI to monitor deployed functions. Receive a list of deployed functions and stream logs from running functions.
Get List of Deployed Functions
Display a list of your deployed functions for easy tracking.
View all your environments and their aliases:
1sf env list
Example output:
1Salesforce Orgs2=======================================================================================================================================3| Aliases Username Org ID Instance Url Auth Method Config4| βββββββ ββββββββββββββββββββββββββββββββββββ ββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββββ βββββββββββ ββββββββββββββ5| rodri.s+functions@salesforce.com 234123412341234123 https://xxx000xxxx001234.my.salesforce.com web target-dev-hub67Scratch Orgs8========================================================================================================================================================9| Aliases Username Org ID Instance Url Auth Method Config10| βββββββββββββββββ βββββββββββββββββββββββββββββ ββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ βββββββββββ ββββββββββ11| MyScratchOrgAlias test-12341234123a@example.com XX010XXXX00abCDEFG https://mycompany.scratch.my.salesforce.com web target-org1213Compute Environments14===========================================================================================================================================15| Alias Project Name Connected Org Alias Connected Org Id Compute Environment Name Compute Environment Id16| ββββββββββββ βββββββββββββββββ βββββββββββββββββββ ββββββββββββββββββ ββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββ17| MyComputeEnv MyFunctionProject MyScratchOrgAlias XX010XXXX00abCDEFG myfunct-xx010xxxx00abcdefg-792 7gh6sda2-8s5n-2j23-wj3e-dfdn1i2313fc18| MyFunctionProject 00D3F000000bJEHUA2 myfunct-00d3f000000bjehua2-712 kj3k6j32-3me3-29ck-bd21-e1i9219jd22a19| MyFunctionProject 00D54000000dXeOEAU myfunct-00d54000000dxeoeau-469 sdka231k-0e3e-210j-a72a-aqwkeqwkwd08
Display details about a specific compute environment:
1sf env display -e MyComputeEnv
Example output:
1Key Value2 ββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββ3 Alias MyComputeEnv4 Environment Name myfunct-XX010XXXX00abCDEFG-25 Project MyFunctionProject6 Created Date 2022-02-24T23:14:04Z7 Connected Org Id XX010XXXX00abCDEFG8 Connected Org Status Active9 Connected Org Alias MyScratchOrgAlias10 Connected Org Username test-1234XXX@example.com11 Functions12 App ID XXXX0000-XXXX-0000-XXXX-XXXX0000XXXX13 Space ID 0000XXXX-0000-XXXX-0000-0000XXXX0000
Stream Function Logs
Salesforce Functions has logging tools to monitor, debug, and analyze how your deployed functions are running at the compute environment level. Logged activity for all functions deployed to a compute environment is captured in the same log. Filter log data by function, date and time, or any other logline field.
Any Apex logs created from your Apex code that invokes a Function isnβt captured in compute environment logs. For dealing with log information from Apex code, see Working with Apex Debug Logs.
Note
Start a Function Log
Environment logs arenβt buffered and logline outputs occur after the command is executed. Start tailing the environment log in a separate shell before the function is invoked to capture log details.
Tip
1sf env log tail -e MyComputeEnvironment
Example output:
12022-02-24T23:14:05.331411+00:00 app[api]: Release v1 created by user 00d5f000006ognfeao-test@herokumanager.com22022-02-24T23:14:05.331411+00:00 app[api]: Initial release by user 00d5f000006ognfeao-test@herokumanager.com32022-02-24T23:14:05.527549+00:00 app[api]: Release v2 created by user 00d5f000006ognfeao_0055f000006voq8aak@evergreeninternal.herokai.com42022-02-24T23:14:05.527549+00:00 app[api]: Enable Logplex by user 00d5f000006ognfeao_0055f000006voq8aak@evergreeninternal.herokai.com
Log information starts to output to the current shell. To stop capturing logs, quit the process by using Ctrl-C in your shell.
The log tail process will terminate after 1 hour of inactivity. Reuse sf env log tail to continue logging.
Run sf env log tail -e MyComputeEnvironment and invoke your function.
Example log output for an invoked function:
Salesforce Functions is no longer available for purchase or renewal. To preserve the capabilities that Salesforce Functions provided to your org, deploy an alternative solution before your existing order term ends. See Salesforce Functions Retirement for more information on migrating your functions. Contact your Salesforce Account Executive for more information on Heroku.