From 7e7d2b94421b9fbe993c3202d738b051e2cfad8b Mon Sep 17 00:00:00 2001 From: Morten Tokle Date: Thu, 21 Jan 2021 14:27:27 +0100 Subject: Remove formatter, always 'messageOnly' --- .../java/com/yahoo/container/logging/AccessLogHandler.java | 4 +--- .../java/com/yahoo/container/logging/ConnectionLogHandler.java | 7 ++----- .../main/java/com/yahoo/container/logging/LogFileHandler.java | 7 +++---- .../com/yahoo/container/logging/LogFileHandlerTestCase.java | 10 +++++----- 4 files changed, 11 insertions(+), 17 deletions(-) (limited to 'jdisc_http_service') diff --git a/jdisc_http_service/src/main/java/com/yahoo/container/logging/AccessLogHandler.java b/jdisc_http_service/src/main/java/com/yahoo/container/logging/AccessLogHandler.java index 64f858ce26e..08be5f2613e 100644 --- a/jdisc_http_service/src/main/java/com/yahoo/container/logging/AccessLogHandler.java +++ b/jdisc_http_service/src/main/java/com/yahoo/container/logging/AccessLogHandler.java @@ -14,9 +14,7 @@ class AccessLogHandler { private final LogFileHandler logFileHandler; AccessLogHandler(AccessLogConfig.FileHandler config) { - LogFormatter lf = new LogFormatter(); - lf.messageOnly(true); - logFileHandler = new LogFileHandler(toCompression(config), config.pattern(), config.rotation(), config.symlink(), lf); + logFileHandler = new LogFileHandler(toCompression(config), config.pattern(), config.rotation(), config.symlink()); } public void log(String message) { diff --git a/jdisc_http_service/src/main/java/com/yahoo/container/logging/ConnectionLogHandler.java b/jdisc_http_service/src/main/java/com/yahoo/container/logging/ConnectionLogHandler.java index d47294915aa..82a84200f10 100644 --- a/jdisc_http_service/src/main/java/com/yahoo/container/logging/ConnectionLogHandler.java +++ b/jdisc_http_service/src/main/java/com/yahoo/container/logging/ConnectionLogHandler.java @@ -13,14 +13,11 @@ class ConnectionLogHandler { private final LogFileHandler logFileHandler; public ConnectionLogHandler(String clusterName) { - LogFormatter lf = new LogFormatter(); - lf.messageOnly(true); logFileHandler = new LogFileHandler( LogFileHandler.Compression.ZSTD, String.format("logs/vespa/qrs/ConnectionLog.%s.%s", clusterName, "%Y%m%d%H%M%S"), "0 60 ...", - String.format("ConnectionLog.%s", clusterName), - lf); + String.format("ConnectionLog.%s", clusterName)); } public void log(String message) { @@ -31,4 +28,4 @@ class ConnectionLogHandler { logFileHandler.close(); logFileHandler.shutdown(); } -} \ No newline at end of file +} diff --git a/jdisc_http_service/src/main/java/com/yahoo/container/logging/LogFileHandler.java b/jdisc_http_service/src/main/java/com/yahoo/container/logging/LogFileHandler.java index 04cbb2217fe..58a324b7f26 100644 --- a/jdisc_http_service/src/main/java/com/yahoo/container/logging/LogFileHandler.java +++ b/jdisc_http_service/src/main/java/com/yahoo/container/logging/LogFileHandler.java @@ -110,16 +110,15 @@ class LogFileHandler { } } - LogFileHandler(Compression compression, String filePattern, String rotationTimes, String symlinkName, Formatter formatter) { - this(compression, filePattern, calcTimesMinutes(rotationTimes), symlinkName, formatter); + LogFileHandler(Compression compression, String filePattern, String rotationTimes, String symlinkName) { + this(compression, filePattern, calcTimesMinutes(rotationTimes), symlinkName); } LogFileHandler( Compression compression, String filePattern, long[] rotationTimes, - String symlinkName, - Formatter formatter) { + String symlinkName) { this.compression = compression; this.filePattern = filePattern; this.rotationTimes = rotationTimes; diff --git a/jdisc_http_service/src/test/java/com/yahoo/container/logging/LogFileHandlerTestCase.java b/jdisc_http_service/src/test/java/com/yahoo/container/logging/LogFileHandlerTestCase.java index a2e56290962..d72a0ef653e 100644 --- a/jdisc_http_service/src/test/java/com/yahoo/container/logging/LogFileHandlerTestCase.java +++ b/jdisc_http_service/src/test/java/com/yahoo/container/logging/LogFileHandlerTestCase.java @@ -48,7 +48,7 @@ public class LogFileHandlerTestCase { return ("["+timeStamp+"]" + " " + formatMessage(r) + "\n"); } }; - LogFileHandler h = new LogFileHandler(Compression.NONE, pattern, rTimes, null, formatter); + LogFileHandler h = new LogFileHandler(Compression.NONE, pattern, rTimes, null); long now = System.currentTimeMillis(); long millisPerDay = 60*60*24*1000; long tomorrowDays = (now / millisPerDay) +1; @@ -69,7 +69,7 @@ public class LogFileHandlerTestCase { File logFile = temporaryFolder.newFile("testLogFileG1.txt"); //create logfilehandler - LogFileHandler h = new LogFileHandler(Compression.NONE, logFile.getAbsolutePath(), "0 5 ...", null, new SimpleFormatter()); + LogFileHandler h = new LogFileHandler(Compression.NONE, logFile.getAbsolutePath(), "0 5 ...", null); //write log LogRecord lr = new LogRecord(Level.INFO, "testDeleteFileFirst1"); @@ -83,7 +83,7 @@ public class LogFileHandlerTestCase { File logFile = temporaryFolder.newFile("testLogFileG2.txt"); //create logfilehandler - LogFileHandler h = new LogFileHandler(Compression.NONE, logFile.getAbsolutePath(), "0 5 ...", null, new SimpleFormatter()); + LogFileHandler h = new LogFileHandler(Compression.NONE, logFile.getAbsolutePath(), "0 5 ...", null); //write log LogRecord lr = new LogRecord(Level.INFO, "testDeleteFileDuringLogging1"); @@ -111,7 +111,7 @@ public class LogFileHandlerTestCase { } }; LogFileHandler handler = new LogFileHandler( - Compression.NONE, root.getAbsolutePath() + "/logfilehandlertest.%Y%m%d%H%M%S%s", new long[]{0}, "symlink", formatter); + Compression.NONE, root.getAbsolutePath() + "/logfilehandlertest.%Y%m%d%H%M%S%s", new long[]{0}, "symlink"); String message = formatter.format(new LogRecord(Level.INFO, "test")); handler.publish(new LogRecord(Level.INFO, message)); @@ -176,7 +176,7 @@ public class LogFileHandlerTestCase { } }; LogFileHandler h = new LogFileHandler( - compression, root.getAbsolutePath() + "/logfilehandlertest.%Y%m%d%H%M%S%s", new long[]{0}, null, formatter); + compression, root.getAbsolutePath() + "/logfilehandlertest.%Y%m%d%H%M%S%s", new long[]{0}, null); int logEntries = 10000; for (int i = 0; i < logEntries; i++) { LogRecord lr = new LogRecord(Level.INFO, "test\n"); -- cgit v1.2.3