function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Aidel BruckAidel Bruck 

How to see the system.debug message when running a trigger test

I have created a trigger and I now testing it from a test class. 
Something is going wrong and I would like to figure out what. 
I am using the salesforce developer console.
I have put system.debug messages in strategic places in the test class and in the trigger itself.
non of them of showing on the logs tab.
I am sure that there is something simple that I am missing. 
Please advice, 
☯ BonY ☯☯ BonY ☯

did you check user assigned on monitor user in debug log?
Vinoth Vijaya BaskerVinoth Vijaya Basker
Hi Aidel, 

If you are using System.assert or any assert related statement in test class, remove it and check again. 

Aidel BruckAidel Bruck
BoniBoss, where will I find that check box?
I am beggining to think I am simply not looking in the right place
is this where I should be looking? see red circle below:
User-added image
Krishna SambarajuKrishna Sambaraju
You are checking at the right place, but before executing the trigger, you need to enable the debug log for the user.
Go to Setup > Debug Logs
setup debug logs

Then add the user who is running the trigger to the list of monitored users. For example if you are testing the trigger, add your name to the monitored users. See screenshot below.
Debug - Monitor Users
Then you will be able to see the logs in the place you have highlighted with red circle.

Hope this helps.
David ZhuDavid Zhu
I think you checked the right place. you may need to check the test case running status in your org at Build | Develop | Apex Test Execution.
And may need to clear cach of your browser and try. It should be like this after running test case. 

User-added image

Or you can try running test case in your org at Build | Develop | Apex Test Execution. 

Ashley ShealeyAshley Shealey
I just had the same issue and it turned out it was because my trigger was not making it past my IF statement and all my debugs were after the IF statement. Hope this helps someone else in the future!