2

As the title mentions, how do we disable okhttp3.internal.platform.Platform.log for any third party dependency in this case might be PubNub. Currently our log files are getting filled up with following text

30-Aug-2019 20:40:54.791 INFO [OkHttp http://ps.pndsn.com/...] okhttp3.internal.platform.Platform.log Date: Fri, 30 Aug 2019 20:40:54 GMT
30-Aug-2019 20:40:54.791 INFO [OkHttp http://ps.pndsn.com/...] okhttp3.internal.platform.Platform.log Content-Type: text/javascript; charset="UTF-8"
30-Aug-2019 20:40:54.791 INFO [OkHttp http://ps.pndsn.com/...] okhttp3.internal.platform.Platform.log Content-Length: 30
30-Aug-2019 20:40:54.791 INFO [OkHttp http://ps.pndsn.com/...] okhttp3.internal.platform.Platform.log Connection: keep-alive
30-Aug-2019 20:40:54.791 INFO [OkHttp http://ps.pndsn.com/...] okhttp3.internal.platform.Platform.log Cache-Control: no-cache
30-Aug-2019 20:40:54.791 INFO [OkHttp http://ps.pndsn.com/...] okhttp3.internal.platform.Platform.log Access-Control-Allow-Origin: *
30-Aug-2019 20:40:54.791 INFO [OkHttp http://ps.pndsn.com/...] okhttp3.internal.platform.Platform.log Access-Control-Allow-Methods: GET

This question has already being asked but with no answers.

We did try some Hail Mary approach like populating our log4j.properties file with following entries

log4j.logger.com.squareup.okhttp3=OFF
log4j.logger.okhttp3.internal.platform=OFF

but they do not seem to work.

Most of these logs are coming for PubNub and that has a dependency for package

<dependency>
    <groupId>com.squareup.okhttp3</groupId>
    <artifactId>logging-interceptor</artifactId>
    <version>3.6.0</version>
</dependency>

hence we suspect that could be the package causing these problems.

Any one with any insights on how to suppress these excess logs?

Soham
  • 671
  • 1
  • 7
  • 23
  • 1
    Soham, do you happen to have logging enabled? Check for setLogVerbosity property during PubNub initialization. What do you have it set to? – Paras Wadehra Aug 30 '19 at 21:41
  • @ParasWadehra you are correct we have set log verbosity to `BODY`, which was causing all the trouble. Thank you. We set the property value `setLogVerbosity` to `PNLogVerbosity.NONE` to resolve our issue. Thank you. – Soham Aug 30 '19 at 22:56
  • OK, let me reply that as the answer so you can mark that as answer. – Paras Wadehra Aug 30 '19 at 23:04

1 Answers1

1

Soham,

It seems like you have logging enabled.

Please update

pnConfiguration.setLogVerbosity(PNLogVerbosity.BODY);

to

pnConfiguration.setLogVerbosity(PNLogVerbosity.NONE);

and that should solve the issue.

Paras Wadehra
  • 490
  • 3
  • 10