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
Ignacio de la torreIgnacio de la torre 

System.debug() not loggin anything after succesfull external call is made

Hi !
I'm having trouble debuggin a method I just wrote:
 
public class getClients {
    public List<Object> callOut(String clientId){
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint('https://api.disputeprocess.com/api/v1/clients?');
        request.setMethod('GET');
        request.setHeader('Content-Type', 'application/json;charset=UTF-8');
        request.setHeader('api_key', 'xxxxx');
        request.setHeader('api_token', 'xxxxx');
        HttpResponse response = http.send(request);
        // If the request is successful, parse the JSON response.
        if (response.getStatusCode() == 200) {
            // Deserialize the JSON string into collections
    		Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
            List<Object> clients = (List<Object>) results.get('clients');
            System.debug('Received the following clients:');
                for (Object client: clients) {
                    System.debug(client);
                }
            return clients;
        }
        else{
            system.debug('Error making the callout');
        }
        
        return null;
    }
}

I'm executing this in the Developer Console in a Anonymous Window and the operation is Succesfull but no debug log is shown when I check the "Debug only" checkbox in the Logs Tab.
As you can see I want to know what the client is to see if it's returning the expected ones.

Debug logs are set to SFDC_DevConsole so that's ok and if I only write System.debug('hello') for example and only execute this in the Anonymous window it does log correctly in the Log Tab, so I can't figure out what the problem might be. Please help 
Agustin BAgustin B
Hi Ignacio, are you sure you are getting clients?
Your debug is inside a for, try System.debug(clients.size()); to validate this.

If it solves your issue please mark this as correct, it may help others.
SwethaSwetha (Salesforce Developers) 
HI Ignacio,
In addition, can you make sure that the log size is within the limit(Each debug log must be 20 MB or smaller). See the article https://help.salesforce.com/articleView?id=code_debug_log.htm&type=5
 
Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful.Thank you