summaryrefslogtreecommitdiffstats
path: root/logserver/src/main/java/com
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2019-03-26 18:01:45 +0100
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2019-03-26 18:02:28 +0100
commit7ba6fbef28e5cc59b4cd993a836b9f5a4ae34110 (patch)
tree94af096234189c2f261c16e2cc8b66a4408e3e8f /logserver/src/main/java/com
parentdc46e712efefb2324869a1abf7baac198b33778e (diff)
Remove unused log formatters from logserver
Diffstat (limited to 'logserver/src/main/java/com')
-rw-r--r--logserver/src/main/java/com/yahoo/logserver/formatter/LogFormatter.java27
-rw-r--r--logserver/src/main/java/com/yahoo/logserver/formatter/LogFormatterManager.java69
-rw-r--r--logserver/src/main/java/com/yahoo/logserver/formatter/NullFormatter.java29
-rw-r--r--logserver/src/main/java/com/yahoo/logserver/formatter/TextFormatter.java51
4 files changed, 0 insertions, 176 deletions
diff --git a/logserver/src/main/java/com/yahoo/logserver/formatter/LogFormatter.java b/logserver/src/main/java/com/yahoo/logserver/formatter/LogFormatter.java
deleted file mode 100644
index 03bb7787b65..00000000000
--- a/logserver/src/main/java/com/yahoo/logserver/formatter/LogFormatter.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.logserver.formatter;
-
-import com.yahoo.log.LogMessage;
-
-/**
- * This interface is analogous to the java.util.logging.Formatter
- * interface. Classes implementing this interface should be
- * <b>stateless/immutable if possible so formatters can be
- * shared</b>. If it does have state it must not prevent
- * concurrent use.
- *
- * @author Bjorn Borud
- */
-public interface LogFormatter {
- /**
- * Format log message as a string.
- *
- * @param msg The log message
- */
- String format(LogMessage msg);
-
- /**
- * Returns a textual description of the formatter
- */
- String description();
-}
diff --git a/logserver/src/main/java/com/yahoo/logserver/formatter/LogFormatterManager.java b/logserver/src/main/java/com/yahoo/logserver/formatter/LogFormatterManager.java
deleted file mode 100644
index 1d0d29adb9e..00000000000
--- a/logserver/src/main/java/com/yahoo/logserver/formatter/LogFormatterManager.java
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-/*
- * $Id$
- *
- */
-
-package com.yahoo.logserver.formatter;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * This singleton class implements a central registry of LogFormatter
- * instances.
- *
- * @author Bjorn Borud
- */
-public class LogFormatterManager {
- private static final LogFormatterManager instance;
-
- static {
- instance = new LogFormatterManager();
- instance.addLogFormatterInternal("system.textformatter", new TextFormatter());
- instance.addLogFormatterInternal("system.nullformatter", new NullFormatter());
- }
-
- private final Map<String, LogFormatter> logFormatters = new HashMap<String, LogFormatter>();
-
- private LogFormatterManager() {}
-
- /**
- * LogFormatter lookup function
- *
- * @param name The name of the LogFormatter to be looked up.
- * @return Returns the LogFormatter associated with this name or
- * <code>null</code> if not found.
- */
- public static LogFormatter getLogFormatter(String name) {
- synchronized (instance.logFormatters) {
- return instance.logFormatters.get(name);
- }
- }
-
- /**
- * Get the names of the defined formatters.
- *
- * @return Returns an array containing the names of formatters that
- * have been registered.
- */
- public static String[] getFormatterNames() {
- synchronized (instance.logFormatters) {
- String[] formatterNames = new String[instance.logFormatters.keySet().size()];
- instance.logFormatters.keySet().toArray(formatterNames);
- return formatterNames;
- }
- }
-
- /**
- * Internal method which takes care of the job of adding
- * LogFormatter mappings but doesn't perform any of the checks
- * performed by the public method for adding mappings.
- */
- private void addLogFormatterInternal(String name, LogFormatter logFormatter) {
- synchronized (logFormatters) {
- logFormatters.put(name, logFormatter);
- }
- }
-
-}
diff --git a/logserver/src/main/java/com/yahoo/logserver/formatter/NullFormatter.java b/logserver/src/main/java/com/yahoo/logserver/formatter/NullFormatter.java
deleted file mode 100644
index c419ce21272..00000000000
--- a/logserver/src/main/java/com/yahoo/logserver/formatter/NullFormatter.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-/*
- * $Id$
- *
- */
-
-package com.yahoo.logserver.formatter;
-
-import com.yahoo.log.LogMessage;
-
-/**
- * This formatter doesn't really format anything. It just
- * calls the LogMessage toString() method. This is kind of
- * pointless and silly, but we include it for symmetry...
- * or completeness....or...whatever.
- *
- * @author Bjorn Borud
- */
-public class NullFormatter implements LogFormatter {
-
- public String format(LogMessage msg) {
- return msg.toString();
- }
-
- public String description() {
- return "Format message in native VESPA format";
- }
-
-}
diff --git a/logserver/src/main/java/com/yahoo/logserver/formatter/TextFormatter.java b/logserver/src/main/java/com/yahoo/logserver/formatter/TextFormatter.java
deleted file mode 100644
index efc4a9898ed..00000000000
--- a/logserver/src/main/java/com/yahoo/logserver/formatter/TextFormatter.java
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-/*
- * $Id$
- *
- */
-
-package com.yahoo.logserver.formatter;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.TimeZone;
-
-import com.yahoo.log.LogMessage;
-
-/**
- * Creates human-readable text representation of log message.
- *
- * @author Bjorn Borud
- */
-public class TextFormatter implements LogFormatter {
- static final SimpleDateFormat dateFormat;
-
- static {
- dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
- }
-
- public String format(LogMessage msg) {
- StringBuffer sbuf = new StringBuffer(150);
- sbuf.append(dateFormat.format(new Date(msg.getTime())))
- .append(" ")
- .append(msg.getHost())
- .append(" ")
- .append(msg.getThreadProcess())
- .append(" ")
- .append(msg.getService())
- .append(" ")
- .append(msg.getComponent())
- .append(" ")
- .append(msg.getLevel().toString())
- .append(" ")
- .append(msg.getPayload())
- .append("\n");
-
- return sbuf.toString();
- }
-
- public String description() {
- return "Format log-message as human readable text";
- }
-}