Suppose I have a test class TestClassName.

private class TestClassName {
static testMethod void testMethodName() {
        System.debug('My debug statement');
        System.assertEquals(1, 1);

Where can I find the log that has the 'My debug statement' output?

It seems that:

  • Force.com shows the log of the actual ClassName class
  • Developer console shows the log of the actual ClassName class
  • Debug Logs doesn't show the logs of the TestClassName test class
  • Apex Test Execution doesn't show any logs
  • You should be able to see the logs of the test class in the developer console, monitored debug logs, and if you are running the tests from eclipse the eclipse test results window. This is probably an issue with your log levels but can you write up how you are running the tests to help us troubleshoot. Commented Feb 14, 2013 at 16:07

3 Answers 3


When you run your test class the debug log does show the logs of even your test execution.

You have to find the user that started the test in question. The user can be found by going to Setup > Develop > Apex Test Execution and inspecting the Test run to find the email of the user.

The line will look like this:

Test run: yyyy-mm-dd hh:MM:ss, [email protected] (n class[es])

Then at Setup > Monitoring > Debug Logs add the user who has the [email protected] email to Monitored Users.

 07:54:37.375 (2375302000)|EXECUTION_STARTED
 07:54:37.375 (2375362000)|CODE_UNIT_STARTED|     [EXTERNAL]|01p90000002IZE6|TestClassName.testMethodName
  07:54:37.376 (2376542000)|METHOD_ENTRY|   [2]|01p90000002IZE6|TestClassName.TestClassName()
 07:54:37.376 (2376557000)|METHOD_EXIT|[2]|TestClassName
 07:54:37.376 (2376695000)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY)
  07:54:37.376 (2376721000)|USER_DEBUG|[4]|DEBUG|My debug statement
  07:54:37.376 (2376731000)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY)
  07:54:37.376 (2376752000)|SYSTEM_METHOD_ENTRY|[5]|System.assertEquals(ANY, ANY)
  07:54:37.376 (2376776000)|SYSTEM_METHOD_EXIT|[5]|System.assertEquals(ANY, ANY)
   07:54:35.608 (2376798000)|CUMULATIVE_LIMIT_USAGE
   Number of SOQL queries: 0 out of 100
   Number of query rows: 0 out of 50000
   Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
   Number of code statements: 2 out of 200000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
 Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
 Number of picklist describes: 0 out of 100
 Number of future calls: 0 out of 10


07:54:37.376 (2376826000)|CODE_UNIT_FINISHED|TestClassName.testMethodName
07:54:37.376 (2376835000)|EXECUTION_FINISHED
  • Can you share step-by-step instructions to get to the log? If I add the appropriate user to Monitored Users, the logs still don't show any activities at the time of tests.
    – ipavlic
    Commented Feb 14, 2013 at 15:48
  • Its very simple.First you have to find the User for which you are running test class.In debug log set that user and refresh.I have updated my answer too with debug log i obtained for your class.Hope it helps Commented Feb 14, 2013 at 15:59
  • Hint the logs never showed any activity signifies that he is not the right user . Commented Feb 14, 2013 at 16:03
  • You are right! I had to put the user who started the test to Monitored Users. One can find that user on the Test Run: [date time], [email] line at Apex Test Execution.
    – ipavlic
    Commented Feb 14, 2013 at 16:06
  • Happens !Glad that i was able to help:) Commented Feb 14, 2013 at 16:07

Launch your Devloper Console (Username>Developer Console)

Go to Setup>Developer>Apex Test Execution>Select Tests> pick the testing class you want to see the debug logs from can click run.

Go to your Dev Console. In the logs section you will see the ApexTestHandler operation. Double click that log. Then check 'Debug Only'. You will see your System.debug lines.


In VS Code, go to the terminal window and enter this command:

sfdx apex:tail:log --color | grep USER_DEBUG 

Then run your tests. The debug messages will show up in the Terminal window. Note that ALL debugs coming from the org which are logged under your userid will be emitted here.


In Windows the commands are, for CMD:

sfdx force:apex:log:tail --color | findstr USER_DEBUG

and PowerShell:

sfdx force:apex:log:tail --color | Select-String USER_DEBUG

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .