Note getting the complete log - Logger.getLog()

170 views
Skip to first unread message

Aaron Weiner

unread,
Oct 17, 2016, 12:20:18 PM10/17/16
to AdWords Scripts Forum
When I use the following code, I don't seem to get the entire log at the end of the execution:


MailApp.sendEmail(MY_EMAIL_ADDRESS,"My Subject", "Raw Log:\n------------------\n" + Logger.getLog());




Is that because I'm using executeInParallel?

Thanks

Aaron



Tyler Sidell (AdWords Scripts Team)

unread,
Oct 17, 2016, 2:26:30 PM10/17/16
to AdWords Scripts Forum
Hi Aaron,

Running the script with executeInParallel should have not affect on the logs not displaying.  Perhaps you are running into a quota of App Scripts, specifically email body size so I'd suggest checking that as a cause.

Thanks,
Tyler Sidell
AdWords Scripts Team

Aaron Weiner

unread,
Oct 17, 2016, 2:43:29 PM10/17/16
to AdWords Scripts Forum
Hello Tyler, 

How can I see where I stand within these quotas? For example, how many URLFetch calls have I already done today?

Also, which column do I look at when it comes to AdWords?


Thanks 
Aaron

Tyler Sidell (AdWords Scripts Team)

unread,
Oct 17, 2016, 4:08:52 PM10/17/16
to AdWords Scripts Forum
Hi Aaron,

There is no dashboard within AdWords that will display these quotas.  However, you can get the quota amount through running some individual scripts.

For example to get the remaining email daily quota:

var emailQuotaRemaining = MailApp.getRemainingDailyQuota();
Logger.log("Remaining email quota: " + emailQuotaRemaining);

In addition, if you are experiencing this issue only on executeInParallel scripts, you can have the parallel function return what it is logging as such:

function main() {
 
MccApp.accounts().executeInParallel('process', 'callback');
}

function process() {
 
var logs = []
 
// do stuff
 
Logger.log(LOG_STATEMENT);
  logs
.push(LOG_STATEMENT);
 
// do more stuff
 
return logs.join('\n');
}

function callback(results) {
 
var allLogs = [];
 
for (var i = 0; i < results.length; i++) {
   
var result = results[i].getReturnValue();
    allLogs
.push(result);
 
}
 
MailApp.sendEmail(EMAIL_ADDRESS, "Subject", allLogs.join("\n\n"));
}

Thanks,
Tyler Sidell
AdWords Scripts Team

Aaron Weiner

unread,
Oct 17, 2016, 5:17:30 PM10/17/16
to AdWords Scripts Forum
Thank you Tyler. 

getRemainingDailyQuota is useful but is that the only item that I can look up?

What about getting information on the URL Fetch quotas? 

Also, which column does AdWords fall in? (Consumer (gmail.com), Google Apps free edition (legacy) or Google Apps for Work/Edu/Gov)

Thanks

Aaron



Tyler Sidell (AdWords Scripts Team)

unread,
Oct 17, 2016, 9:45:13 PM10/17/16
to AdWords Scripts Forum
Hi Aaron,

Apologies for misunderstanding your question but the column is based on your Google account.  It depends which account you are using for AdWords Scripts to determine which it falls under.

Unfortunately there is no API method to determine URL Fetch quotas.  AdWords Product team may be able to assist with those numbers.

Thanks,
Tyler Sidell
AdWords Scripts Team

Reply all
Reply to author
Forward
0 new messages