diff options
author | Harald Musum <musum@yahoo-inc.com> | 2017-05-22 09:29:31 +0200 |
---|---|---|
committer | Harald Musum <musum@yahoo-inc.com> | 2017-05-22 09:29:31 +0200 |
commit | 0d7a03ac62312f5bb169b80379c2e2d543cb1674 (patch) | |
tree | b6600c84da04f2dd0f4e59af271c5bbb2fbc6871 /config-proxy/src | |
parent | 9182275d6c42bda068238225de0534536d8fc997 (diff) |
Less logging at debug level
* In particular, do not log config payload unless log level is spam
Diffstat (limited to 'config-proxy/src')
-rw-r--r-- | config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ConfigProxyRpcServer.java | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ConfigProxyRpcServer.java b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ConfigProxyRpcServer.java index eff25aa9191..35dcf522682 100644 --- a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ConfigProxyRpcServer.java +++ b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ConfigProxyRpcServer.java @@ -110,7 +110,7 @@ public class ConfigProxyRpcServer implements Runnable, TargetWatcher, RpcServer */ @SuppressWarnings({"UnusedDeclaration"}) public final void getConfigV3(Request req) { - log.log(LogLevel.SPAM, "getConfigV3"); + log.log(LogLevel.SPAM, () -> "getConfigV3"); JRTServerConfigRequest request = JRTServerConfigRequestV3.createFromRequest(req); if (isProtocolVersionSupported(request)) { preHandle(req); @@ -144,9 +144,7 @@ public class ConfigProxyRpcServer implements Runnable, TargetWatcher, RpcServer */ private void getConfigImpl(JRTServerConfigRequest request) { request.getRequestTrace().trace(TRACELEVEL, "Config proxy getConfig()"); - if (log.isLoggable(LogLevel.DEBUG)) { - log.log(LogLevel.DEBUG, "getConfig: " + request.getShortDescription() + ",configmd5=" + request.getRequestConfigMd5()); - } + log.log(LogLevel.DEBUG, () ->"getConfig: " + request.getShortDescription() + ",configmd5=" + request.getRequestConfigMd5()); if (!request.validateParameters()) { // Error code is set in verifyParameters if parameters are not OK. log.log(LogLevel.WARNING, "Parameters for request " + request + " did not validate: " + request.errorCode() + " : " + request.errorMessage()); @@ -156,15 +154,11 @@ public class ConfigProxyRpcServer implements Runnable, TargetWatcher, RpcServer try { RawConfig config = proxyServer.resolveConfig(request); if (config == null) { - if (log.isLoggable(LogLevel.DEBUG)) { - log.log(LogLevel.DEBUG, "No config received yet for " + request.getShortDescription() + ", not sending response"); - } + log.log(LogLevel.SPAM, () -> "No config received yet for " + request.getShortDescription() + ", not sending response"); } else if (ProxyServer.configOrGenerationHasChanged(config, request)) { returnOkResponse(request, config); } else { - if (log.isLoggable(LogLevel.DEBUG)) { - log.log(LogLevel.DEBUG, "No new config for " + request.getShortDescription() + ", not sending response"); - } + log.log(LogLevel.SPAM, "No new config for " + request.getShortDescription() + ", not sending response"); } } catch (Exception e) { e.printStackTrace(); @@ -245,7 +239,7 @@ public class ConfigProxyRpcServer implements Runnable, TargetWatcher, RpcServer public final void setMode(Request req) { String suppliedMode = req.parameters().get(0).asString(); - log.log(LogLevel.DEBUG, "Supplied mode=" + suppliedMode); + log.log(LogLevel.DEBUG, () -> "Supplied mode=" + suppliedMode); String[] s = new String[2]; if (Mode.validModeName(suppliedMode.toLowerCase())) { proxyServer.setMode(suppliedMode); @@ -303,12 +297,12 @@ public class ConfigProxyRpcServer implements Runnable, TargetWatcher, RpcServer */ @Override public void notifyTargetInvalid(Target target) { - log.log(LogLevel.DEBUG, "Target invalid " + target); + log.log(LogLevel.DEBUG, () -> "Target invalid " + target); for (Iterator<DelayedResponse> it = proxyServer.delayedResponses.responses().iterator(); it.hasNext(); ) { DelayedResponse delayed = it.next(); JRTServerConfigRequest request = delayed.getRequest(); if (request.getRequest().target().equals(target)) { - log.log(LogLevel.DEBUG, "Removing " + request.getShortDescription()); + log.log(LogLevel.DEBUG, () -> "Removing " + request.getShortDescription()); it.remove(); } } @@ -319,17 +313,17 @@ public class ConfigProxyRpcServer implements Runnable, TargetWatcher, RpcServer public void returnOkResponse(JRTServerConfigRequest request, RawConfig config) { request.getRequestTrace().trace(TRACELEVEL, "Config proxy returnOkResponse()"); request.addOkResponse(config.getPayload(), config.getGeneration(), config.getConfigMd5()); - if (log.isLoggable(LogLevel.DEBUG)) { - log.log(LogLevel.DEBUG, "Return response: " + request.getShortDescription() + ",configMd5=" + config.getConfigMd5() + - ",config=" + config.getPayload() + ",generation=" + config.getGeneration()); - } + log.log(LogLevel.DEBUG, () -> "Return response: " + request.getShortDescription() + ",configMd5=" + config.getConfigMd5() + + ",generation=" + config.getGeneration()); + log.log(LogLevel.SPAM, () -> "Config payload in response for " + request.getShortDescription() + ":" + config.getPayload()); + // TODO Catch exception for now, since the request might have been returned in CheckDelayedResponse // TODO Move logic so that all requests are returned in CheckDelayedResponse try { request.getRequest().returnRequest(); } catch (IllegalStateException e) { - log.log(LogLevel.DEBUG, "Something bad happened when sending response for '" + request.getShortDescription() + "':" + e.getMessage()); + log.log(LogLevel.DEBUG, () -> "Something bad happened when sending response for '" + request.getShortDescription() + "':" + e.getMessage()); } } |