googleads / googleads-php-lib

Google Ad Manager SOAP API Client Library for PHP
Apache License 2.0
656 stars 769 forks source link

WARNING in logs but everything works as expected #354

Closed nhtahoe closed 7 years ago

nhtahoe commented 7 years ago

According to the documentation on logging in the Google Ads API Client Library for PHP, a WARNING in the logs means "failure".

However, I'm able to successfully run my queries, gets, and mutates even though my logs look like below. Any ideas what the "WARNING" is about?"

[2017-09-09 14:30:07] local.WARNING: CampaignService 201708  
[2017-09-09 14:30:08] local.INFO: clientCustomerId=###### operations=1 service=CampaignService method=query responseTime=380 requestId=##### server=adwords.google.com isFault=0 faultMessage=  
[2017-09-09 14:30:08] local.DEBUG: POST /api/adwords/cm/v201708/CampaignService?wsdl HTTP/1.1
Host: adwords.google.com
Connection: close
User-Agent: PHP-SOAP/7.1.6-1~ubuntu16.04.1+deb.sury.org+1
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Content-Length: 1568
Authorization: REDACTED

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201708"><SOAP-ENV:Header><ns1:RequestHeader><ns1:clientCustomerId>#####</ns1:clientCustomerId><ns1:developerToken>REDACTED</ns1:developerToken><ns1:userAgent>unknown (AwApi-PHP, googleads-php-lib/29.0.0, PHP/7.1.6-1~ubuntu16.04.1+deb.sury.org+1)</ns1:userAgent><ns1:validateOnly>false</ns1:validateOnly><ns1:partialFailure>false</ns1:partialFailure></ns1:RequestHeader></SOAP-ENV:Header><SOAP-ENV:Body><ns1:query><ns1:query>SELECT AdServingOptimizationStatus, AdvertisingChannelSubType, AdvertisingChannelType, Amount, BaseCampaignId, BiddingStrategyId, BiddingStrategyName, BiddingStrategyType, BudgetId, BudgetName, BudgetReferenceCount, BudgetStatus, CampaignGroupId, CampaignTrialType, DeliveryMethod, Eligible, EndDate, EnhancedCpcEnabled, FrequencyCapMaxImpressions, Id, IsBudgetExplicitlyShared, Labels, Level, Name, RejectionReasons, SelectiveOptimization, ServingStatus, Settings, StartDate, Status, TargetContentNetwork, TargetCpa, TargetCpaMaxCpcBidCeiling, TargetCpaMaxCpcBidFloor, TargetGoogleSearch, TargetPartnerSearchNetwork, TargetRoas, TargetRoasBidCeiling, TargetRoasBidFloor, TargetSearchNetwork, TargetSpendBidCeiling, TargetSpendEnhancedCpcEnabled, TargetSpendSpendTarget, TimeUnit, TrackingUrlTemplate, UrlCustomParameters, VanityPharmaDisplayUrlMode, VanityPharmaText ORDER BY Name LIMIT 0,500</ns1:query></ns1:query></SOAP-ENV:Body></SOAP-ENV:Envelope>

HTTP/1.1 200 OK
Content-Type: text/xml; charset=UTF-8
Date: Sat, 09 Sep 2017 21:30:08 GMT
Expires: Sat, 09 Sep 2017 21:30:08 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alt-Svc: quic=":443"; ma=2592000; v="39,38,37,35"
Accept-Ranges: none
Vary: Accept-Encoding
Connection: close

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201708"><requestId>####</requestId><serviceName>CampaignService</serviceName><methodName>query</methodName><operations>1</operations><responseTime>380</responseTime></ResponseHeader></soap:Header><soap:Body><queryResponse xmlns="https://adwords.google.com/api/adwords/cm/v201708"><rval><totalNumEntries>0</totalNumEntries><Page.Type>CampaignPage</Page.Type></rval></queryResponse></soap:Body></soap:Envelope>
fiboknacky commented 7 years ago

Could you please tell what you've run? Just a GetCampaigns example?

nhtahoe commented 7 years ago

I'm using AWQL to fetch Campaigns in an account and with the library installed as a Web App. Also happening when I use AWQL to fetch Ads in an adgroup with AdGroupService:

[2017-09-11 12:00:15] local.WARNING: AdGroupService 201708 [2017-09-11 12:00:16] local.INFO: clientCustomerId=###operations=1 service=AdGroupService method=query responseTime=357 requestId=###server= adwords.google.com isFault=0 faultMessage= [2017-09-11 12:00:16] local.DEBUG: POST /api/adwords/cm/v201708/AdGroupService?wsdl HTTP/1.1 Host: adwords.google.com Connection: close User-Agent: PHP-SOAP/7.1.6-1~ubuntu16.04.1+deb.sury.org+1 Content-Type: text/xml; charset=utf-8 SOAPAction: "" Content-Length: 963 Authorization: REDACTED

<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201708">####</ns1:clientCustomerId>REDACTED</ns1:developerToken>unknown (AwApi-PHP, googleads-php-lib/29.0.0, PHP/7.1.6-1~ubuntu16.04.1+deb.sury.org+1)</ns1:userAgent>false</ns1:validateOnly>false</ns1:partialFailure></ns1:RequestHeader></SOAP-ENV:Header>SELECT AdGroupType, BaseAdGroupId, BaseCampaignId, BiddingStrategySource, CampaignId, CampaignName, ContentBidCriterionTypeGroup, CpcBid, CpmBid, Id, Labels, Name, Settings, Status, TargetCpaBid, TargetCpaBidSource, TargetRoasOverride, TrackingUrlTemplate, UrlCustomParameters LIMIT 0,500</ns1:query></ns1:query></SOAP-ENV:Body></SOAP-ENV:Envelope>

HTTP/1.1 200 OK Content-Type: text/xml; charset=UTF-8 Date: Mon, 11 Sep 2017 19:00:16 GMT Expires: Mon, 11 Sep 2017 19:00:16 GMT Cache-Control: private, max-age=0 X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block Server: GSE Alt-Svc: quic=":443"; ma=2592000; v="39,38,37,35" Accept-Ranges: none Vary: Accept-Encoding Connection: close

###AdGroupServicequery1357 .... On Mon, Sep 11, 2017 at 11:35 AM, Thanet Knack Praneenararat < notifications@github.com> wrote: > Could you please tell what you've run? Just a GetCampaigns > > example? > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > , > or mute the thread > > . >
fiboknacky commented 7 years ago

Hmm.. Could you share the code snippet that does this and relevant parts in adsapi_php.ini too please? It looks like your code has been modified in a way that it produces the service and version used at WARNING level.

If unmodified, the code should produce logs with AW_SOAP as a prefix (as specified at this line):

[2017-09-12 12:03:13] AW_SOAP.INFO: clientCustomerId=xxxx operations=1 service=CampaignService method=get .... (snip) ...

But yours are:

[2017-09-11 12:00:16] local.INFO: clientCustomerId=###operations=1 ... (snip) ...
nhtahoe commented 7 years ago

Tuns out this was totally my bad, and you can close the issue. As I was gathering code snippets to share with you, I realized that it is my code that was adding the WARNING log lines. My logs now look like:

[2017-09-12 10:22:13] local.INFO: clientCustomerId=xxxx operations=1 service=CampaignService method=query responseTime=125 requestId=xxxx server= adwords.google.com isFault=0 faultMessage= [2017-09-12 10:22:13] local.INFO: clientCustomerId=xxxx operations=1 service=AdGroupAdService method=query responseTime=198 requestId=xxxx server=adwords.google.com isFault=0 faultMessage=

I think the reason my logs are startng with local.INFO is that I'm not using the adsapi_php.ini file, and instead setting logger as follows on the session:

    $session = (new \Google\AdsApi\AdWords\AdWordsSessionBuilder())
        ->withDeveloperToken(env('ADWORDS_DEVELOPER_TOKEN'))
        ->withSoapLogger(\Illuminate\Support\Facades\Log::getMonolog())
        ->withOAuth2Credential($oAuth2);

On Mon, Sep 11, 2017 at 8:07 PM, Thanet Knack Praneenararat < notifications@github.com> wrote:

Hmm.. Could you share the code snippet that does this and relevant parts in adsapi_php.ini too please? It looks like your code has been modified in a way that it produces the service and version used at WARNING level.

If unmodified, the code should produce logs with AW_SOAP as a prefix (as specified at [this line](and relevant parts in adsapi_php.ini )):

[2017-09-12 12:03:13] AW_SOAP.INFO: clientCustomerId=xxxx operations=1 service=CampaignService method=get .... (snip) ...

But yours are:

[2017-09-11 12:00:16] local.INFO: clientCustomerId=###operations=1 ... (snip) ...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/googleads/googleads-php-lib/issues/354#issuecomment-328720857, or mute the thread https://github.com/notifications/unsubscribe-auth/AKdsMKuf5UhXaUIge4vIXqjbe8M1zl-Oks5shfV7gaJpZM4PTkkz .

fiboknacky commented 7 years ago

Thanks for getting back to me.