0

I'm connected to a Playground org in VS Code.

I have made and deployed a class to this org and would like to run some anonymous code in VS Code to test a method of the class.

I was able to do this by Ctrl + Shift + P and SFDX: Execute Anonymous Apex with Editor Contents. However, the output is too verbose:

enter image description here

...whereas I would like to view |USER_DEBUG| entries only.

This answer suggests using sfdx force:apex:log:tail (since I'm on Windows, I had to use findstr instead of grep), but got the following error:

enter image description here

I also tried using the --loglevel argument instead of grep and got the same error:

enter image description here

But when I supply my username, nothing happens - the prompt just hangs:

enter image description here

When I press Ctrl + C, it asks me if I want to Terminate batch job (Y/N)?

Could it be because I'm using a Playground org instead of a scratch org?


EDIT: I tried running it in the VS Code terminal to no avail:

enter image description here

3
  • You need to be either in a project workspace with a default username set, a global default username set, or specified with the -u argument. It appears you're in your home directory, which typically wouldn't be a suitable place for development.
    – sfdcfox
    Oct 31, 2022 at 1:26
  • Thanks @sfdcfox, so I should first navigate to my project directory before running the command? I tried that with C:\Users\<user>\Desktop\VSCodeQuickStart> sfdx force:apex:log:tail -u <myusername> --loglevel=debug, but it just hangs again. I'm not sure about the default username. The default username in my project's .sfdx-config.json is set to "vscodeOrg", but running sfdx force:apex:log:tail -u vscodeOrg --loglevel=debug doesn't work.
    – user135792
    Oct 31, 2022 at 2:39
  • @sfdcfox, is there any other way to suppress non-USER_DEBUG output?
    – user135792
    Oct 31, 2022 at 3:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy