md samual
md samual

Reputation: 325

How to disable google ads output in terminal

I am using google ads api and displaying Google adwords ads on our site. At every request the terminal displaying logging request and response. I want to know that is there any way to disable request/response Info from console. I am using google ads java library. I tried to use new RequestLogger But I could not disable that. Below is the given message type which I am getting at every google ads api call.

com.google.api.client.http.HttpTransport [] - -------------- REQUEST  --------------
POST https://oauth.googleapis.com/token
Accept-Encoding: gzip
User-Agent: Google-HTTP-Java-Client/1.39.0 (gzip)
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Content-Length: 241
com.google.api.client.http.HttpTransport [] - curl -v --compressed -X POST -H 'Accept-Encoding: gzip' -H 'User-Agent: Google-HTTP-Java-Client/1.39.0 (gzip)' -H 'Content-Typ
e: application/x-www-form-urlencoded; charset=UTF-8' -d '@-' -- 'https://oauth2.googleapis.com/token' << $$$
com.google.api.client.http.HttpTransport [] - Total: 241 bytes
com.google.api.client.http.HttpTransport [] - client_id=xxxx&refresh_token=xxxx&grant_type=refresh_token
com.google.api.client.http.HttpTransport [] - -------------- RESPONSE --------------
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Alt-Svc: h3=":443"; ma=2592000,h3-29=":111"; ma=333,h3-T051=":3"; ma=000,h3-Q050=":443"; ma=2000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"
46,43"
Server: scaffolding on HTTPServer2
X-Content-Type-Options: nosniff
Pragma: no-cache

Upvotes: 1

Views: 577

Answers (1)

user18433025
user18433025

Reputation:

There are several levels of logging for Google ads

    const ALERT     = 'alert';
    const CRITICAL  = 'critical';
    const ERROR     = 'error';
    const WARNING   = 'warning';
    const NOTICE    = 'notice';
    const INFO      = 'info';
    const DEBUG     = 'debug';

The default logging level is info. For PHP, we can change logging level with code:

            ->from($configuration)
            ->withOAuth2Credential($oAuth2Credential)
            ->withLogLevel('error')
            ->build();

Or set it in the configure file.

I believe you can do similar things in Java

Upvotes: 1

Related Questions