Skip to content

Commit

Permalink
Merge pull request #182 from brharrington/wire-logging
Browse files Browse the repository at this point in the history
add flags for enabling wire logging
  • Loading branch information
brharrington committed Oct 19, 2015
2 parents ac82a3c + d4e1a31 commit 0fc9f93
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions iep-rxhttp/src/main/java/com/netflix/iep/http/ClientConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.netflix.iep.http;

import io.netty.handler.logging.LogLevel;
import org.apache.commons.configuration.Configuration;

import java.net.URI;
Expand Down Expand Up @@ -197,6 +198,20 @@ boolean gzipEnabled() {
return getBoolean("GzipEnabled", true);
}

/**
* Should detailed wire logging be enabled on the underlying client?
*/
boolean wireLoggingEnabled() {
return getBoolean("WireLoggingEnabled", false);
}

/**
* Log level to use for logging events.
*/
LogLevel wireLoggingLevel() {
return LogLevel.valueOf(getString("WireLoggingLevel", "ERROR"));
}

/** Max number of retries. */
int numRetries() {
return getInt("MaxAutoRetriesNextServer", 2);
Expand Down
4 changes: 4 additions & 0 deletions iep-rxhttp/src/main/java/com/netflix/iep/http/RxHttp.java
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,10 @@ private HttpClient<ByteBuf, ByteBuf> newClient(final RequestContext context) {
.withName(clientCfg.name())
.channelOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, clientCfg.connectTimeout());

if (clientCfg.wireLoggingEnabled()) {
builder.enableWireLogging(clientCfg.wireLoggingLevel());
}

final int idleTimeout = clientCfg.idleConnectionsTimeoutMillis();
if (idleTimeout == 0) {
builder.withNoConnectionPooling();
Expand Down

0 comments on commit 0fc9f93

Please sign in to comment.