MODULE REFERENCE / psfdx-logs
psfdx-logs
Logging and diagnostics
Retrieve and follow debug logs, trace flags, flow interviews, login history and event monitoring.
Part of the psfdx package, which installs every module: see the installation and update instructions.
PS> Get-Command -Module psfdx-logsCommands
Download Markdown · Source history on GitHub
Convert-SalesforceDebugLog
Synopsis
Converts the text of a debug log into one object per line (in development).
Syntax
Convert-SalesforceDebugLog [-Log] <String> [<CommonParameters>]Description
Does not use the Salesforce CLI. Pipe in the text of a log, for example from Get-SalesforceDebugLogs -Raw; the first (header) line is skipped and each remaining line is split on | into DateTime, LogType and, when present, SubType and Detail. It writes a warning that it is still in development, so the properties may change.
Parameters
-LogString, required- The log text to convert. Accepts pipeline input. Required.
Salesforce CLI
No direct Salesforce CLI command.
Examples
PS> Get-SalesforceDebugLogs -Last 1 -Raw -TargetOrg dev1 | Convert-SalesforceDebugLog | Select-Object -First 20The first twenty log lines as objects.
Remarks
- To see the examples, type: "Get-Help Convert-SalesforceDebugLog -Examples"
- For more information, type: "Get-Help Convert-SalesforceDebugLog -Detailed"
- For technical information, type: "Get-Help Convert-SalesforceDebugLog -Full"
- For online help, type: "Get-Help Convert-SalesforceDebugLog -Online"
Related Links
Disable-SalesforceDebugLogging
Synopsis
Deletes a trace flag to stop debug logging (sf apex trace delete).
Syntax
Disable-SalesforceDebugLogging [-TraceId] <String> [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]Description
-TraceId can come from the pipeline: a trace flag from Get-SalesforceDebugLogging is used through its Id. Each flag is confirmed on its own, so -WhatIf previews every delete, and an org with no trace flags deletes nothing.
Parameters
-TraceIdString, required- ID of the trace flag to delete. Passed to sf as --trace-flag-id. Required. Alias: Id, TraceFlagId. Accepts input from the pipeline by property name.
-TargetOrgString- Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
-WhatIfswitch-Confirmswitch
Salesforce CLI
sf apex trace delete
Examples
PS> Get-SalesforceDebugLogging -TargetOrg myorg | Disable-SalesforceDebugLogging -TargetOrg myorg -WhatIfRemarks
- To see the examples, type: "Get-Help Disable-SalesforceDebugLogging -Examples"
- For more information, type: "Get-Help Disable-SalesforceDebugLogging -Detailed"
- For technical information, type: "Get-Help Disable-SalesforceDebugLogging -Full"
- For online help, type: "Get-Help Disable-SalesforceDebugLogging -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-apex
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Enable-SalesforceDebugLogging
Synopsis
Turns on debug logging for a user, Apex class or Apex trigger by creating a trace flag.
Syntax
Enable-SalesforceDebugLogging -TracedEntityId <String> -DebugLevel <String> [-LogType <String>] [-Duration <Int32>] [-TargetOrg <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
Enable-SalesforceDebugLogging -Username <String> -DebugLevel <String> [-LogType <String>] [-Duration <Int32>] [-TargetOrg <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
Enable-SalesforceDebugLogging -ApexClass <String> -DebugLevel <String> [-LogType <String>] [-Duration <Int32>] [-TargetOrg <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
Enable-SalesforceDebugLogging -ApexTrigger <String> -DebugLevel <String> [-LogType <String>] [-Duration <Int32>] [-TargetOrg <String>] [-WhatIf] [-Confirm] [<CommonParameters>]Description
Runs sf apex trace create for a user. Identify what to trace with one of -TracedEntityId, -Username, -ApexClass or -ApexTrigger; the last three are looked up with a SOQL query first and the cmdlet stops if no record, or more than one, matches. -DebugLevel names an existing debug level. The trace flag stays until it expires or you remove it with Disable-SalesforceDebugLogging.
Salesforce traces an Apex class or trigger only with a CLASS_TRACING trace flag, which sf apex trace create cannot make. So for -ApexClass, -ApexTrigger, or a -TracedEntityId of a class (01p) or trigger (01q), psfdx looks up the debug level's ID and creates the TraceFlag Tooling API record itself with New-SalesforceRecord, starting now and expiring after -Duration minutes (30 by default, as sf does). -LogType does not apply there.
Parameters
-TracedEntityIdString, required- ID of the user, Apex class, or Apex trigger to trace. Passed to sf as --traced-entity-id. Required in the Id parameter set.
-UsernameString, required- User name of the user to trace. psfdx looks up the user's ID and passes it as --traced-entity-id. Required in the Username parameter set.
-ApexClassString, required- Name of the Apex class to trace. psfdx looks up its ID and creates a CLASS_TRACING trace flag for it. Required in the ApexClass parameter set.
-ApexTriggerString, required- Name of the Apex trigger to trace. psfdx looks up its ID and creates a CLASS_TRACING trace flag for it. Required in the ApexTrigger parameter set.
-DebugLevelString, required- Developer name of an existing debug level to apply. Passed to sf as --debug-level. Required.
-LogTypeString- Type of trace flag to create for a user. Passed to sf as --log-type. Valid values: DEVELOPER_LOG, USER_DEBUG. Not allowed when tracing an Apex class or trigger, which always uses CLASS_TRACING.
-DurationInt32- Duration, in minutes, before the trace flag expires. Maximum is 1440 (24 hours). Passed to sf as --duration; for an Apex class or trigger it sets the trace flag's ExpirationDate (default 30). Range: 1 to 1440.
-TargetOrgString- Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
-WhatIfswitch-Confirmswitch
Salesforce CLI
sf apex trace create
Examples
PS> Enable-SalesforceDebugLogging -Username [email protected] -DebugLevel SFDC_DevConsole -Duration 60 -TargetOrg dev1Trace one user for an hour.
Remarks
- To see the examples, type: "Get-Help Enable-SalesforceDebugLogging -Examples"
- For more information, type: "Get-Help Enable-SalesforceDebugLogging -Detailed"
- For technical information, type: "Get-Help Enable-SalesforceDebugLogging -Full"
- For online help, type: "Get-Help Enable-SalesforceDebugLogging -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-apex
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Export-SalesforceDebugLogs
Synopsis
Saves the most recent debug logs to files.
Syntax
Export-SalesforceDebugLogs [[-Limit] <Int32>] [[-OutputFolder] <String>] [[-TargetOrg] <String>] [<CommonParameters>]Description
Lists the logs with Select-SalesforceDebugLogs, keeps the first -Limit of them and writes each one with Get-SalesforceDebugLogs to <log id>.log in the output folder, with a progress bar. Existing files with the same name are overwritten.
Parameters
-LimitInt32- How many logs to save, taken from the start of the list the CLI returns. Default 50. Default: 50.
-OutputFolderString- Folder to write the .log files to. It must exist. Defaults to the current folder.
-TargetOrgString- Username or alias of the org to read the logs from. If omitted, the Salesforce CLI uses the default target org.
Salesforce CLI
No direct Salesforce CLI command.
Examples
PS> Export-SalesforceDebugLogs -Limit 5 -OutputFolder .\logs -TargetOrg dev1Save the five newest logs.
Remarks
- To see the examples, type: "Get-Help Export-SalesforceDebugLogs -Examples"
- For more information, type: "Get-Help Export-SalesforceDebugLogs -Detailed"
- For technical information, type: "Get-Help Export-SalesforceDebugLogs -Full"
- For online help, type: "Get-Help Export-SalesforceDebugLogs -Online"
Related Links
Export-SalesforceEventFile
Synopsis
Downloads one Event Monitoring log file and saves it as a CSV.
Syntax
Export-SalesforceEventFile [-Id] <String> [[-OutputFolder] <String>] [[-TargetOrg] <String>] [<CommonParameters>]Description
Gets the file with Get-SalesforceEventFile and writes it to <Id>.csv in the output folder. The ID must be a 15 or 18 character Salesforce ID, so it cannot point outside the folder.
Parameters
-IdString, required- ID of the EventLogFile record. Required.
-OutputFolderString- Folder to write the CSV to. It must exist. Defaults to the current folder.
-TargetOrgString- Username or alias of the org. If omitted, the Salesforce CLI uses the default target org.
Salesforce CLI
No direct Salesforce CLI command.
Examples
PS> Export-SalesforceEventFile -Id 0AT000000000001AAA -OutputFolder .\events -TargetOrg prodSave one event log file.
Remarks
- To see the examples, type: "Get-Help Export-SalesforceEventFile -Examples"
- For more information, type: "Get-Help Export-SalesforceEventFile -Detailed"
- For technical information, type: "Get-Help Export-SalesforceEventFile -Full"
- For online help, type: "Get-Help Export-SalesforceEventFile -Online"
Related Links
Export-SalesforceEventFiles
Synopsis
Downloads several Event Monitoring log files as CSVs.
Syntax
Export-SalesforceEventFiles [[-EventType] <String>] [[-After] <DateTime>] [[-Before] <DateTime>] [[-Limit] <Int32>] [[-OutputFolder] <String>] [[-TargetOrg] <String>] [<CommonParameters>]Description
Finds files with Select-SalesforceEventFiles using the filters you give, then saves each one with Export-SalesforceEventFile, with a progress bar. See Select-SalesforceEventFiles for how the filters work.
Parameters
-EventTypeString- SOQL query to execute. Passed to sf as --query.
-AfterDateTime- SOQL query to execute. Passed to sf as --query.
-BeforeDateTime- SOQL query to execute. Passed to sf as --query.
-LimitInt32- SOQL query to execute. Passed to sf as --query. Default: 200.
-OutputFolderString- Folder to write the CSV files to. It must exist. Defaults to the current folder.
-TargetOrgString- Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
Salesforce CLI
sf data query
Examples
PS> Export-SalesforceEventFiles -EventType Login -After (Get-Date).AddDays(-7) -OutputFolder .\events -TargetOrg prodLast week's login event files.
Remarks
- To see the examples, type: "Get-Help Export-SalesforceEventFiles -Examples"
- For more information, type: "Get-Help Export-SalesforceEventFiles -Detailed"
- For technical information, type: "Get-Help Export-SalesforceEventFiles -Full"
- For online help, type: "Get-Help Export-SalesforceEventFiles -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-data
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Get-SalesforceDebugLogging
Synopsis
Lists the trace flags that turn on debug logging.
Syntax
Get-SalesforceDebugLogging [[-TargetOrg] <String>] [<CommonParameters>]Description
Runs sf apex trace list and returns one object per trace flag. Pipe them to Disable-SalesforceDebugLogging to remove them.
Parameters
-TargetOrgString- Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
Salesforce CLI
sf apex trace list
Examples
PS> Get-SalesforceDebugLogging -TargetOrg dev1Active trace flags.
Remarks
- To see the examples, type: "Get-Help Get-SalesforceDebugLogging -Examples"
- For more information, type: "Get-Help Get-SalesforceDebugLogging -Detailed"
- For technical information, type: "Get-Help Get-SalesforceDebugLogging -Full"
- For online help, type: "Get-Help Get-SalesforceDebugLogging -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-apex
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Get-SalesforceDebugLogs
Synopsis
Fetches one debug log, or the newest few, from an org.
Syntax
Get-SalesforceDebugLogs [[-OutputDirectory] <String>] [[-LogId] <String>] [[-Last] <Int32>] [-Raw] [[-TargetOrg] <String>] [<CommonParameters>]Description
Runs sf apex get log with --log-id or --number. Give exactly one of -LogId and -Last. With -OutputDirectory the CLI saves the logs as files; with -Raw the text is returned as it is.
Parameters
-OutputDirectoryString- Directory for saving the log files. Passed to sf as --output-dir.
-LogIdString- ID of the specific log to display. Passed to sf as --log-id.
-LastInt32- Fetch this many of the newest logs. Passed as --number. Use instead of -LogId.
-Rawswitch- Return the log text as the CLI prints it.
-TargetOrgString- Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
Salesforce CLI
sf apex get log
Examples
PS> Get-SalesforceDebugLogs -Last 1 -Raw -TargetOrg dev1The newest log, as text.
Remarks
- To see the examples, type: "Get-Help Get-SalesforceDebugLogs -Examples"
- For more information, type: "Get-Help Get-SalesforceDebugLogs -Detailed"
- For technical information, type: "Get-Help Get-SalesforceDebugLogs -Full"
- For online help, type: "Get-Help Get-SalesforceDebugLogs -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-apex
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Get-SalesforceEventFile
Synopsis
Downloads the content of one Event Monitoring log file.
Syntax
Get-SalesforceEventFile [-Id] <String> [[-TargetOrg] <String>] [<CommonParameters>]Description
Finds the newest REST API version of the org, then runs sf api request rest on /services/data/<version>/sobjects/EventLogFile/<Id>/Logfile and returns the CSV text. The ID must be a 15 or 18 character Salesforce ID.
Parameters
-IdString, required- ID of the EventLogFile record. Required.
-TargetOrgString- Username or alias of the org. If omitted, the Salesforce CLI uses the default target org. Passed to sf as --target-org.
Salesforce CLI
sf api request rest
Examples
PS> Get-SalesforceEventFile -Id 0AT000000000001AAA -TargetOrg prodThe CSV of that file.
Remarks
- To see the examples, type: "Get-Help Get-SalesforceEventFile -Examples"
- For more information, type: "Get-Help Get-SalesforceEventFile -Detailed"
- For technical information, type: "Get-Help Get-SalesforceEventFile -Full"
- For online help, type: "Get-Help Get-SalesforceEventFile -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-api
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Get-SalesforceFlowInterviews
Synopsis
Lists flow interviews, for example the ones that failed.
Syntax
Get-SalesforceFlowInterviews [[-Type] <String>] [[-After] <DateTime>] [[-Limit] <Int32>] [[-TargetOrg] <String>] [<CommonParameters>]Description
Runs sf data query on FlowInterview (Id, CreatedDate, InterviewLabel, InterviewStatus, Error) filtered by status and optional date, newest first. Values are escaped as SOQL literals.
Parameters
-TypeString- Interview status to list: Error, Paused, Running, Completed, VersionPaused, Autosaved, Expired, or All (the default). Default: All. Valid values: Error, Paused, Running, Completed, VersionPaused, Autosaved, Expired, All.
-AfterDateTime- Only interviews created at or after this time.
-LimitInt32- SOQL query to execute. Passed to sf as --query. Default: 200.
-TargetOrgString- Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
Salesforce CLI
sf data query
Examples
PS> Get-SalesforceFlowInterviews -Type Error -After (Get-Date).AddDays(-1) -TargetOrg prodFlow errors in the last day.
Remarks
- To see the examples, type: "Get-Help Get-SalesforceFlowInterviews -Examples"
- For more information, type: "Get-Help Get-SalesforceFlowInterviews -Detailed"
- For technical information, type: "Get-Help Get-SalesforceFlowInterviews -Full"
- For online help, type: "Get-Help Get-SalesforceFlowInterviews -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-data
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Get-SalesforceLoginFailures
Synopsis
Lists login attempts that did not succeed.
Syntax
Get-SalesforceLoginFailures [[-After] <DateTime>] [[-Before] <DateTime>] [[-Limit] <Int32>] [[-Username] <String>] [[-TargetOrg] <String>] [<CommonParameters>]Description
Calls Get-SalesforceLoginHistory with the same filters and keeps the rows whose Status is not Success. Returns an empty array when there are none.
Parameters
-AfterDateTime- Only logins at or after this time.
-BeforeDateTime- Only logins at or before this time.
-LimitInt32- Maximum number of login history rows to read before filtering.
-UsernameString- Only this user name.
-TargetOrgString- Username or alias of the org. If omitted, the Salesforce CLI uses the default target org.
Salesforce CLI
No direct Salesforce CLI command.
Examples
PS> Get-SalesforceLoginFailures -After (Get-Date).AddDays(-1) -TargetOrg prodFailed logins in the last day.
Remarks
- To see the examples, type: "Get-Help Get-SalesforceLoginFailures -Examples"
- For more information, type: "Get-Help Get-SalesforceLoginFailures -Detailed"
- For technical information, type: "Get-Help Get-SalesforceLoginFailures -Full"
- For online help, type: "Get-Help Get-SalesforceLoginFailures -Online"
Related Links
Get-SalesforceLoginHistory
Synopsis
Lists login history records, newest first.
Syntax
Get-SalesforceLoginHistory [[-After] <DateTime>] [[-Before] <DateTime>] [[-Username] <String>] [[-Limit] <Int32>] [[-TargetOrg] <String>] [<CommonParameters>]Description
Runs sf data query on LoginHistory (Id, LoginTime, UserId, SourceIp, Application, Status). The user filter is applied through a subquery on User. Values are escaped as SOQL literals.
Parameters
-AfterDateTime- Only logins at or after this time.
-BeforeDateTime- Only logins at or before this time.
-UsernameString- Only this user name.
-LimitInt32- SOQL query to execute. Passed to sf as --query.
-TargetOrgString- Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
Salesforce CLI
sf data query
Examples
PS> Get-SalesforceLoginHistory -Username [email protected] -Limit 20 -TargetOrg prodThe last twenty logins of one user.
Remarks
- To see the examples, type: "Get-Help Get-SalesforceLoginHistory -Examples"
- For more information, type: "Get-Help Get-SalesforceLoginHistory -Detailed"
- For technical information, type: "Get-Help Get-SalesforceLoginHistory -Full"
- For online help, type: "Get-Help Get-SalesforceLoginHistory -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-data
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Out-Notepad
Synopsis
Shows text in Notepad (Windows only).
Syntax
Out-Notepad [-Content] <String> [<CommonParameters>]Description
Does not use the Salesforce CLI. Pipe text in; it is written to a new temporary file that Notepad opens. The file is not deleted afterwards, so remove it if the text is sensitive. On other systems it does nothing.
Parameters
-ContentString, required- The text to show. Accepts pipeline input. Required.
Salesforce CLI
No direct Salesforce CLI command.
Examples
PS> Get-SalesforceDebugLogs -Last 1 -Raw -TargetOrg dev1 | Out-NotepadRead the newest log in Notepad.
Remarks
- To see the examples, type: "Get-Help Out-Notepad -Examples"
- For more information, type: "Get-Help Out-Notepad -Detailed"
- For technical information, type: "Get-Help Out-Notepad -Full"
- For online help, type: "Get-Help Out-Notepad -Online"
Related Links
Select-SalesforceDebugLogs
Synopsis
Lists the debug logs in an org.
Syntax
Select-SalesforceDebugLogs [[-TargetOrg] <String>] [<CommonParameters>]Description
Runs sf apex list log and returns one object per log (Id, Application, Operation, StartTime, LogLength, and so on), in the order the CLI returns them.
Parameters
-TargetOrgString- Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
Salesforce CLI
sf apex list log
Examples
PS> Select-SalesforceDebugLogs -TargetOrg dev1 | Select-Object -First 5The five newest logs.
Remarks
- To see the examples, type: "Get-Help Select-SalesforceDebugLogs -Examples"
- For more information, type: "Get-Help Select-SalesforceDebugLogs -Detailed"
- For technical information, type: "Get-Help Select-SalesforceDebugLogs -Full"
- For online help, type: "Get-Help Select-SalesforceDebugLogs -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-apex
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Select-SalesforceEventFiles
Synopsis
Lists Event Monitoring log files.
Syntax
Select-SalesforceEventFiles [[-EventType] <String>] [[-After] <DateTime>] [[-Before] <DateTime>] [[-Limit] <Int32>] [[-TargetOrg] <String>] [<CommonParameters>]Description
Runs sf data query on EventLogFile (Id, EventType, LogDate, LogFileLength, Sequence, Interval, CreatedDate), newest log date first, with optional filters. Values are escaped as SOQL literals.
Parameters
-EventTypeString- Only this event type, for example Login or ApexExecution. Passed to sf as --query.
-AfterDateTime- Only files with a LogDate at or after this time. Passed to sf as --query.
-BeforeDateTime- Only files with a LogDate at or before this time. Passed to sf as --query.
-LimitInt32- Maximum number of files to return. Passed to sf as --query.
-TargetOrgString- Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
Salesforce CLI
sf data query
Examples
PS> Select-SalesforceEventFiles -EventType Login -Limit 10 -TargetOrg prodThe ten newest login files.
Remarks
- To see the examples, type: "Get-Help Select-SalesforceEventFiles -Examples"
- For more information, type: "Get-Help Select-SalesforceEventFiles -Detailed"
- For technical information, type: "Get-Help Select-SalesforceEventFiles -Full"
- For online help, type: "Get-Help Select-SalesforceEventFiles -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-data
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Watch-SalesforceDebugLogs
Synopsis
Streams debug logs from an org to the terminal.
Syntax
Watch-SalesforceDebugLogs [[-DebugLevel] <String>] [-SkipTraceFlag] [[-TargetOrg] <String>] [<CommonParameters>]Description
Runs sf apex tail log with --color, which keeps running until you press Ctrl+C. Unless you pass -SkipTraceFlag the CLI first creates a trace flag for you, which stays after you stop.
Parameters
-DebugLevelString- Debug level to set on the DEVELOPER_LOG trace flag for your user. Passed to sf as --debug-level.
-SkipTraceFlagswitch- Skip trace flag setup. Assumes that a trace flag and debug level are fully set up. Adds --skip-trace-flag.
-TargetOrgString- Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
Salesforce CLI
sf apex tail log
Examples
PS> Watch-SalesforceDebugLogs -DebugLevel SFDC_DevConsole -TargetOrg dev1Follow the logs of the org.
Remarks
- To see the examples, type: "Get-Help Watch-SalesforceDebugLogs -Examples"
- For more information, type: "Get-Help Watch-SalesforceDebugLogs -Detailed"
- For technical information, type: "Get-Help Watch-SalesforceDebugLogs -Full"
- For online help, type: "Get-Help Watch-SalesforceDebugLogs -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-apex
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Further reference: repository command catalogue · Salesforce CLI parity report.
