You need to sign in to do that
Don't have an account?
mustafatop
Why don't view debug rows that generates by System.debug() method in Salesforce?
I have created a batchable class for a production system. If following code doesn't work, any code does not work.
The code is in production system now. It takes daily exchange rates from a site everyday and creates Currency__c records. If it works when exchange rates haven't published, it takes last day exchange rates. But it does not work the way I want and I would like to test it at debug logs.
Following method "getXML(Date today)" has never invoked when I viewed debug logs. Therefore System.debug('test: ' + result); has also never invoked.
How can I see this log?
public String getXML(Date today){ counter += 1; if(counter == 11) return ''; try{ Http h = new Http(); HttpRequest req = new HttpRequest(); String m = today.month() + ''; if((today.month()+'').length()==1) m = '0' + today.month(); String d = today.day() + ''; if((today.day()+'').length()==1) d = '0' + today.day(); String donem = today.year() + '' + m; String formattedDate = d + '' + m + today.year(); req.setEndpoint('http://www.tcmb.gov.tr/kurlar/' + donem + '/' + formattedDate + '.xml'); req.setMethod('GET'); String result = ''; if (!Test.isRunningTest()){ HttpResponse res = h.send(req); result = res.getBody(); } else { result += 'test'; } System.debug('test: ' + result); if(res.getStatusCode()==404){ return getXML(today.addDays(-1)); } return result; }catch(Exception e){ return getXML(today); } }