diff options
author | gjoranv <gv@verizonmedia.com> | 2020-04-25 15:32:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-25 15:32:53 +0200 |
commit | 35decca41db6b9a44b24b6f7501c84d159ebd6a7 (patch) | |
tree | b81ae29b3ca1bf9b9b118c89bca6ac371029e13c /container-core | |
parent | bcc30b625534f8034575debb5e057c4e72abef93 (diff) | |
parent | 9093fa66b3588e32573c57e2322da4b18e1f8c8d (diff) |
Merge pull request #13061 from vespa-engine/gjoranv/use-java-logging-level
Gjoranv/use java logging level
Diffstat (limited to 'container-core')
10 files changed, 33 insertions, 33 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/core/config/HandlersConfigurerDi.java b/container-core/src/main/java/com/yahoo/container/core/config/HandlersConfigurerDi.java index d87b38e8b18..270decfeaeb 100644 --- a/container-core/src/main/java/com/yahoo/container/core/config/HandlersConfigurerDi.java +++ b/container-core/src/main/java/com/yahoo/container/core/config/HandlersConfigurerDi.java @@ -20,7 +20,7 @@ import com.yahoo.jdisc.application.OsgiFramework; import com.yahoo.jdisc.handler.RequestHandler; import com.yahoo.jdisc.service.ClientProvider; import com.yahoo.jdisc.service.ServerProvider; -import com.yahoo.log.LogLevel; +import java.util.logging.Level; import com.yahoo.osgi.OsgiImpl; import com.yahoo.osgi.OsgiWrapper; import com.yahoo.statistics.Statistics; @@ -57,7 +57,7 @@ public class HandlersConfigurerDi { ComponentRegistry<RequestHandler> requestHandlerRegistry, ComponentRegistry<ClientProvider> clientProviderRegistry, ComponentRegistry<ServerProvider> serverProviderRegistry) { - log.log(LogLevel.DEBUG, "RegistriesHack.init " + System.identityHashCode(this)); + log.log(Level.FINE, "RegistriesHack.init " + System.identityHashCode(this)); vespaContainer.setComponentRegistry(allComponents); vespaContainer.setRequestHandlerRegistry(requestHandlerRegistry); diff --git a/container-core/src/main/java/com/yahoo/container/handler/VipStatusHandler.java b/container-core/src/main/java/com/yahoo/container/handler/VipStatusHandler.java index eceffb379aa..f2df5ddb7c5 100644 --- a/container-core/src/main/java/com/yahoo/container/handler/VipStatusHandler.java +++ b/container-core/src/main/java/com/yahoo/container/handler/VipStatusHandler.java @@ -18,7 +18,7 @@ import com.yahoo.container.jdisc.HttpRequest; import com.yahoo.container.jdisc.HttpResponse; import com.yahoo.container.jdisc.ThreadedHttpRequestHandler; import com.yahoo.jdisc.Metric; -import com.yahoo.log.LogLevel; +import java.util.logging.Level; import com.yahoo.text.Utf8; import com.yahoo.vespa.defaults.Defaults; diff --git a/container-core/src/main/java/com/yahoo/container/jdisc/ContentChannelOutputStream.java b/container-core/src/main/java/com/yahoo/container/jdisc/ContentChannelOutputStream.java index dc3bd6fe8a8..9c48955bf4c 100644 --- a/container-core/src/main/java/com/yahoo/container/jdisc/ContentChannelOutputStream.java +++ b/container-core/src/main/java/com/yahoo/container/jdisc/ContentChannelOutputStream.java @@ -5,7 +5,7 @@ import com.yahoo.io.BufferChain; import com.yahoo.io.WritableByteTransmitter; import com.yahoo.jdisc.handler.CompletionHandler; import com.yahoo.jdisc.handler.ContentChannel; -import com.yahoo.log.LogLevel; +import java.util.logging.Level; import com.yahoo.yolean.Exceptions; import java.io.IOException; @@ -159,9 +159,9 @@ public class ContentChannelOutputStream extends OutputStream implements Writable Level logLevel; synchronized (failLock) { if (failed) { - logLevel = LogLevel.SPAM; + logLevel = Level.FINEST; } else { - logLevel = LogLevel.DEBUG; + logLevel = Level.FINE; } failed = true; } diff --git a/container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java b/container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java index 62dc81aa103..e0fc79b4be9 100644 --- a/container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java +++ b/container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java @@ -11,7 +11,7 @@ import com.yahoo.jdisc.Response; import com.yahoo.jdisc.handler.CompletionHandler; import com.yahoo.jdisc.handler.ContentChannel; import com.yahoo.jdisc.http.server.jetty.AccessLoggingRequestHandler; -import com.yahoo.log.LogLevel; +import java.util.logging.Level; import com.yahoo.yolean.Exceptions; import java.io.IOException; @@ -166,7 +166,7 @@ public abstract class LoggingRequestHandler extends ThreadedHttpRequestHandler { b.append("Timeout: ").append(timeoutInterval).append(" ms. "); b.append("Request string: ").append(req); - log.log(LogLevel.WARNING, "Slow execution. " + b); + log.log(Level.WARNING, "Slow execution. " + b); } private static class NullResponse extends ExtendedResponse { @@ -227,8 +227,8 @@ public abstract class LoggingRequestHandler extends ThreadedHttpRequestHandler { public void failed(Throwable throwable) { long endTime = System.currentTimeMillis(); writeToLogs(endTime); - if (log.isLoggable(LogLevel.DEBUG)) { - log.log(LogLevel.DEBUG, "Got exception when writing to client: " + Exceptions.toMessageString(throwable)); + if (log.isLoggable(Level.FINE)) { + log.log(Level.FINE, "Got exception when writing to client: " + Exceptions.toMessageString(throwable)); } } @@ -308,7 +308,7 @@ public abstract class LoggingRequestHandler extends ThreadedHttpRequestHandler { logEntry.setHttpMethod(AccessLogUtil.getHttpMethod(httpRequest)); logEntry.setHttpVersion(AccessLogUtil.getHttpVersion(httpRequest)); } catch (Exception e) { - log.log(LogLevel.WARNING, "Could not populate the access log [" + fullRequest + "]", e); + log.log(Level.WARNING, "Could not populate the access log [" + fullRequest + "]", e); } } diff --git a/container-core/src/main/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandler.java b/container-core/src/main/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandler.java index c58d49bf8c8..3a99ee7d0c6 100644 --- a/container-core/src/main/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandler.java +++ b/container-core/src/main/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandler.java @@ -9,7 +9,7 @@ import com.yahoo.jdisc.handler.CompletionHandler; import com.yahoo.jdisc.handler.ContentChannel; import com.yahoo.jdisc.handler.UnsafeContentInputStream; import com.yahoo.jdisc.handler.ResponseHandler; -import com.yahoo.log.LogLevel; +import java.util.logging.Level; import java.io.IOException; import java.nio.ByteBuffer; @@ -69,8 +69,8 @@ public abstract class ThreadedHttpRequestHandler extends ThreadedRequestHandler @Override public final void handleRequest(Request request, BufferedContentChannel requestContent, ResponseHandler responseHandler) { - if (log.isLoggable(LogLevel.DEBUG)) { - log.log(LogLevel.DEBUG, "In " + this.getClass() + ".handleRequest()"); + if (log.isLoggable(Level.FINE)) { + log.log(Level.FINE, "In " + this.getClass() + ".handleRequest()"); } com.yahoo.jdisc.http.HttpRequest jdiscRequest = asHttpRequest(request); HttpRequest httpRequest = new HttpRequest(jdiscRequest, new UnsafeContentInputStream(requestContent.toReadable())); @@ -83,7 +83,7 @@ public abstract class ThreadedHttpRequestHandler extends ThreadedRequestHandler } catch (Exception e) { metric.add(UNHANDLED_EXCEPTIONS_METRIC, 1L, contextFor(request, Map.of("exception", e.getClass().getSimpleName()))); metric.add(RENDERING_ERRORS, 1, null); - log.log(LogLevel.ERROR, "Uncaught exception handling request", e); + log.log(Level.SEVERE, "Uncaught exception handling request", e); if (channel != null) { channel.setHttpResponse(null); channel.close(null); @@ -118,7 +118,7 @@ public abstract class ThreadedHttpRequestHandler extends ThreadedRequestHandler catch (IOException e) { metric.add(RENDERING_ERRORS, 1, null); long time = System.currentTimeMillis() - startTime; - log.log(time < 900 ? LogLevel.INFO : LogLevel.WARNING, + log.log(time < 900 ? Level.INFO : Level.WARNING, "IO error while responding to " + " [" + request.getUri() + "] " + "(total time " + time + " ms) ", e); @@ -191,8 +191,8 @@ public abstract class ThreadedHttpRequestHandler extends ThreadedRequestHandler return responseHandler.handleResponse(httpResponse.getJdiscResponse()); } catch (Exception e) { metric.add(RENDERING_ERRORS, 1, null); - if (log.isLoggable(LogLevel.DEBUG)) { - log.log(LogLevel.DEBUG, "Error writing response to client - connection probably terminated " + + if (log.isLoggable(Level.FINE)) { + log.log(Level.FINE, "Error writing response to client - connection probably terminated " + "from client side.", e); } return new DevNullChannel(); // Ignore further operations on this diff --git a/container-core/src/main/java/com/yahoo/container/jdisc/ThreadedRequestHandler.java b/container-core/src/main/java/com/yahoo/container/jdisc/ThreadedRequestHandler.java index 99732af9d31..34ba7676680 100644 --- a/container-core/src/main/java/com/yahoo/container/jdisc/ThreadedRequestHandler.java +++ b/container-core/src/main/java/com/yahoo/container/jdisc/ThreadedRequestHandler.java @@ -15,7 +15,7 @@ import com.yahoo.jdisc.handler.OverloadException; import com.yahoo.jdisc.handler.ReadableContentChannel; import com.yahoo.jdisc.handler.ResponseDispatch; import com.yahoo.jdisc.handler.ResponseHandler; -import com.yahoo.log.LogLevel; +import java.util.logging.Level; import java.net.URI; import java.time.Duration; @@ -147,7 +147,7 @@ public abstract class ThreadedRequestHandler extends AbstractRequestHandler { currentFailureIntervalStartedMillis = 0L; numRejectedRequests = 0; } - log.log(LogLevel.WARNING, "Rejected " + numRejectedRequestsSnapshot + " requests on cause of no available worker threads."); + log.log(Level.WARNING, "Rejected " + numRejectedRequestsSnapshot + " requests on cause of no available worker threads."); } private void incrementRejectedRequests() { diff --git a/container-core/src/main/java/com/yahoo/container/jdisc/state/StateMonitor.java b/container-core/src/main/java/com/yahoo/container/jdisc/state/StateMonitor.java index faa08402cdc..78b65622150 100644 --- a/container-core/src/main/java/com/yahoo/container/jdisc/state/StateMonitor.java +++ b/container-core/src/main/java/com/yahoo/container/jdisc/state/StateMonitor.java @@ -7,7 +7,7 @@ import com.yahoo.container.jdisc.config.HealthMonitorConfig; import com.yahoo.jdisc.Timer; import com.yahoo.jdisc.application.MetricConsumer; import com.yahoo.jdisc.core.SystemTimer; -import com.yahoo.log.LogLevel; +import java.util.logging.Level; import java.util.Map; import java.util.TreeSet; @@ -78,7 +78,7 @@ public class StateMonitor extends AbstractComponent { public void status(Status status) { if (status != this.status) { - log.log(LogLevel.INFO, "Changing health status code from '" + this.status + "' to '" + status.name() + "'"); + log.log(Level.INFO, "Changing health status code from '" + this.status + "' to '" + status.name() + "'"); this.status = status; } } diff --git a/container-core/src/main/java/com/yahoo/processing/rendering/AsynchronousSectionedRenderer.java b/container-core/src/main/java/com/yahoo/processing/rendering/AsynchronousSectionedRenderer.java index a18d1eee0fc..ba246f26639 100644 --- a/container-core/src/main/java/com/yahoo/processing/rendering/AsynchronousSectionedRenderer.java +++ b/container-core/src/main/java/com/yahoo/processing/rendering/AsynchronousSectionedRenderer.java @@ -7,7 +7,7 @@ import com.google.common.util.concurrent.SettableFuture; import com.yahoo.concurrent.ThreadFactoryFactory; import com.yahoo.jdisc.handler.CompletionHandler; import com.yahoo.jdisc.handler.ContentChannel; -import com.yahoo.log.LogLevel; +import java.util.logging.Level; import com.yahoo.processing.Request; import com.yahoo.processing.Response; import com.yahoo.processing.execution.Execution; @@ -471,7 +471,7 @@ public abstract class AsynchronousSectionedRenderer<RESPONSE extends Response> e stream.close(); } catch (IOException e) { closeException = e; - logger.log(LogLevel.WARNING, "Exception caught while closing stream to client.", e); + logger.log(Level.WARNING, "Exception caught while closing stream to client.", e); } finally { if (failed != null) { success.setException(failed); @@ -527,9 +527,9 @@ public abstract class AsynchronousSectionedRenderer<RESPONSE extends Response> e try { render(); } catch (Exception e) { - Level level = LogLevel.WARNING; + Level level = Level.WARNING; if ((e instanceof IOException)) { - level = LogLevel.DEBUG; + level = Level.FINE; if ( ! clientClosed) { clientClosed = true; onClientClosed(); diff --git a/container-core/src/main/java/com/yahoo/restapi/JacksonJsonResponse.java b/container-core/src/main/java/com/yahoo/restapi/JacksonJsonResponse.java index f261c7611f1..94785819aa6 100644 --- a/container-core/src/main/java/com/yahoo/restapi/JacksonJsonResponse.java +++ b/container-core/src/main/java/com/yahoo/restapi/JacksonJsonResponse.java @@ -5,7 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.yahoo.container.jdisc.HttpResponse; -import com.yahoo.log.LogLevel; +import java.util.logging.Level; import java.io.IOException; import java.io.OutputStream; @@ -37,9 +37,9 @@ public class JacksonJsonResponse<T> extends HttpResponse { @Override public void render(OutputStream outputStream) throws IOException { - if (log.isLoggable(LogLevel.DEBUG)) { + if (log.isLoggable(Level.FINE)) { String json = jsonMapper.writeValueAsString(entity); - log.log(LogLevel.DEBUG, "Writing the following JSON to response output stream:\n" + json); + log.log(Level.FINE, "Writing the following JSON to response output stream:\n" + json); outputStream.write(json.getBytes()); } else { jsonMapper.writeValue(outputStream, entity); diff --git a/container-core/src/test/java/com/yahoo/container/jdisc/LoggingTestCase.java b/container-core/src/test/java/com/yahoo/container/jdisc/LoggingTestCase.java index 507ef6952b6..22e55eb5291 100644 --- a/container-core/src/test/java/com/yahoo/container/jdisc/LoggingTestCase.java +++ b/container-core/src/test/java/com/yahoo/container/jdisc/LoggingTestCase.java @@ -3,7 +3,7 @@ package com.yahoo.container.jdisc; import com.yahoo.jdisc.handler.CompletionHandler; import com.yahoo.jdisc.handler.ContentChannel; -import com.yahoo.log.LogLevel; +import java.util.logging.Level; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -101,9 +101,9 @@ public class LoggingTestCase { stream.send(createData()); stream.send(createData()); stream.flush(); - assertNull(logChecker.errorCounter.get(LogLevel.INFO)); - assertEquals(1, logChecker.errorCounter.get(LogLevel.DEBUG).intValue()); - assertEquals(2, logChecker.errorCounter.get(LogLevel.SPAM).intValue()); + assertNull(logChecker.errorCounter.get(Level.INFO)); + assertEquals(1, logChecker.errorCounter.get(Level.FINE).intValue()); + assertEquals(2, logChecker.errorCounter.get(Level.FINEST).intValue()); } } |