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 

system.debug statements suddenly not showing

Hi, 
I have suddenly stopped being able to see the system.debug statements in my log. 
Any ideas why this could have happened?
Sitarama MurthySitarama Murthy
Hi Aidel,

Reason for seeing Debug stmts in Log file is may be the Method which incldes the debug stmt is not executing.

can u please provide the Code.

Thanks,
Ram
Aidel BruckAidel Bruck
The method is executing. My code has 100% code coverage. 
I ran some old test methods that have system.debug statements that I was once able to view in the log and they don't appear anymore. 
I have not changed anything so I can't imagine what the issue would be. 
I am including the code below even though it is not problematic.

trigger: 
trigger UpdateAddress on Account (after update) 
{
    Contact relatedContact= new contact();
    List<contact> contactstoupdate = new list<contact>();
    
    // Step 1: Create a set of all values to query
        set<string> patientids= new set<string>();
    
        for (account a: trigger.new)
            patientids.add(a.Patient_ID__c);
    
    // Step 2: Query for all the family members in Step 1
      List<contact> contactlist = [SELECT id ,     Home_Address__c, patient_id__C FROM contact
                                 WHERE Patient_ID__c IN :patientids];
    
      // Step 3: Make a Map that lets you search for contact by id
    Map<string, contact> conMap = new Map<string, contact>();
      for (contact c: contactlist)
        if(c.patient_id__c!=null)
        {
              conMap.put(c.patient_id__c, c);
          }
    
    //step4
    if(!conmap.isEmpty())
        for(account anew: trigger.new)
            for(account aold: trigger.old)
                if(anew.id== aold.Id )
    {    
      
        relatedcontact= new contact();
        relatedcontact= conmap.get(anew.Patient_ID__c);
        relatedcontact.Home_Address__c=  anew.PersonMailingstreet+' '+anew.PersonMailingcity+' '+anew.PersonMailingstate+' '+
                                            anew.PersonMailingcountry+ ' ' +anew.PersonMailingpostalcode;
        contactstoupdate.add(relatedcontact);
        
            
    }
       

test class

@istest
public class testUpdateAddress 
{
    
    static testMethod void updateAddress()
    {
        account a= new account();
        contact c= new contact();
        family_member__C fm= new family_member__C();
        
        a= TestDataFactory.createPersonAccount();
       
        
        test.startTest();
        
        insert a;
      
        
        a.PersonMailingState='anystate';
        a.PersonMailingStreet='anystreet';
        a.PersonMailingCity= 'anycity';
        a.PersonMailingCountry= 'anycountry';
        a.PersonMailingPostalCode='anyzip';
        
        
        update a;
        
        c= testdatafactory.CreateFamilyContact('lastname' , '11111111');
        fm= testdatafactory.CreateFatherFamilyMemberPrimary(A, C);
        insert fm;
            
        c.Patient_ID__c= [select patient_id__C from account where id=:a.id].patient_id__C;
        
        update c;
        
        a.PersonMailingState='changestate';
        a.PersonMailingStreet='changestreet';
        a.PersonMailingCity= 'changecity';
        a.PersonMailingCountry= 'changecountry';
        a.PersonMailingPostalCode='changezip';
        
        update a;
        
        system.debug(LoggingLevel.Info,c.Home_Address__c);
        
        test.stopTest();
        
    }
   
    
}