aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--container-disc/src/main/java/com/yahoo/container/jdisc/ConfiguredApplication.java5
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/core/ApplicationLoader.java4
-rw-r--r--vespalog/abi-spec.json12
-rw-r--r--vespalog/src/main/java/com/yahoo/log/InitializeLog.java20
-rw-r--r--vespalog/src/main/java/com/yahoo/log/LogSetup.java4
-rw-r--r--vespalog/src/main/java/com/yahoo/log/impl/LogUtils.java1
6 files changed, 39 insertions, 7 deletions
diff --git a/container-disc/src/main/java/com/yahoo/container/jdisc/ConfiguredApplication.java b/container-disc/src/main/java/com/yahoo/container/jdisc/ConfiguredApplication.java
index 2c25f38437a..0fa2c248df2 100644
--- a/container-disc/src/main/java/com/yahoo/container/jdisc/ConfiguredApplication.java
+++ b/container-disc/src/main/java/com/yahoo/container/jdisc/ConfiguredApplication.java
@@ -42,7 +42,7 @@ import com.yahoo.jrt.Supervisor;
import com.yahoo.jrt.Transport;
import com.yahoo.jrt.slobrok.api.Register;
import com.yahoo.jrt.slobrok.api.SlobrokList;
-import com.yahoo.log.LogSetup;
+import com.yahoo.log.InitializeLog;
import com.yahoo.messagebus.network.rpc.SlobrokConfigSubscriber;
import com.yahoo.net.HostName;
import com.yahoo.vespa.config.ConfigKey;
@@ -109,7 +109,7 @@ public final class ConfiguredApplication implements Application {
private volatile boolean shutdownReconfiguration = false;
static {
- LogSetup.initVespaLogging("Container");
+ InitializeLog.init();
log.log(Level.INFO, "Starting jdisc" + (Vtag.currentVersion.isEmpty() ? "" : " at version " + Vtag.currentVersion));
installBouncyCastleSecurityProvider();
}
@@ -460,7 +460,6 @@ public final class ConfiguredApplication implements Application {
slobrokConfigSubscriber.ifPresent(SlobrokConfigSubscriber::shutdown);
Container.get().shutdown();
unregisterInSlobrok();
- LogSetup.cleanup();
shutdownDeadline.cancel();
log.info("Destroy: Finished");
}
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/core/ApplicationLoader.java b/jdisc_core/src/main/java/com/yahoo/jdisc/core/ApplicationLoader.java
index 952e8dd5f00..4ccec132ccc 100644
--- a/jdisc_core/src/main/java/com/yahoo/jdisc/core/ApplicationLoader.java
+++ b/jdisc_core/src/main/java/com/yahoo/jdisc/core/ApplicationLoader.java
@@ -16,6 +16,8 @@ import com.yahoo.jdisc.application.OsgiHeader;
import com.yahoo.jdisc.service.ContainerNotReadyException;
import com.yahoo.jdisc.service.CurrentContainer;
import com.yahoo.jdisc.statistics.ContainerWatchdogMetrics;
+import com.yahoo.log.InitializeLog;
+import com.yahoo.log.LogSetup;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
@@ -46,6 +48,7 @@ public class ApplicationLoader implements BootstrapLoader, ContainerActivator, C
private ApplicationInUseTracker applicationInUseTracker;
public ApplicationLoader(OsgiFramework osgiFramework, Iterable<? extends Module> guiceModules) {
+ InitializeLog.init();
this.osgiFramework = osgiFramework;
this.guiceModules.install(new ApplicationEnvironmentModule(this));
this.guiceModules.installAll(guiceModules);
@@ -198,6 +201,7 @@ public class ApplicationLoader implements BootstrapLoader, ContainerActivator, C
try {
watchdog.close();
osgiFramework.stop();
+ LogSetup.cleanup();
} catch (BundleException | InterruptedException e) {
e.printStackTrace();
}
diff --git a/vespalog/abi-spec.json b/vespalog/abi-spec.json
index 996cc0259a0..7c4d72f1728 100644
--- a/vespalog/abi-spec.json
+++ b/vespalog/abi-spec.json
@@ -15,6 +15,18 @@
],
"fields": []
},
+ "com.yahoo.log.InitializeLog": {
+ "superClass": "java.lang.Object",
+ "interfaces": [],
+ "attributes": [
+ "public"
+ ],
+ "methods": [
+ "public void <init>()",
+ "public static void init()"
+ ],
+ "fields": []
+ },
"com.yahoo.log.InvalidLogFormatException": {
"superClass": "java.lang.Exception",
"interfaces": [],
diff --git a/vespalog/src/main/java/com/yahoo/log/InitializeLog.java b/vespalog/src/main/java/com/yahoo/log/InitializeLog.java
new file mode 100644
index 00000000000..0bb2916b438
--- /dev/null
+++ b/vespalog/src/main/java/com/yahoo/log/InitializeLog.java
@@ -0,0 +1,20 @@
+package com.yahoo.log;
+
+/**
+ * Sets up Vespa logging. Call a setup method to set up this.
+ *
+ * @author baldersheim
+ */
+public class InitializeLog {
+ static {
+ LogSetup.initVespaLogging("Container");
+ }
+
+ /**
+ * Do not delete this method even if it's empty.
+ * Calling this methods forces this class to be loaded,
+ * which runs the static block.
+ */
+ @SuppressWarnings("UnusedDeclaration")
+ public static void init() { }
+}
diff --git a/vespalog/src/main/java/com/yahoo/log/LogSetup.java b/vespalog/src/main/java/com/yahoo/log/LogSetup.java
index 67fb7f71a2d..d285382849e 100644
--- a/vespalog/src/main/java/com/yahoo/log/LogSetup.java
+++ b/vespalog/src/main/java/com/yahoo/log/LogSetup.java
@@ -1,8 +1,6 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.log;
-import com.yahoo.log.impl.LogUtils;
-
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -25,7 +23,7 @@ import java.util.logging.Logger;
@SuppressWarnings("removal")
public class LogSetup {
- private static Timer taskRunner = new Timer(true);
+ private static final Timer taskRunner = new Timer(true);
/**
* A global task thread
diff --git a/vespalog/src/main/java/com/yahoo/log/impl/LogUtils.java b/vespalog/src/main/java/com/yahoo/log/impl/LogUtils.java
index 8c182625c85..e8d7b17abff 100644
--- a/vespalog/src/main/java/com/yahoo/log/impl/LogUtils.java
+++ b/vespalog/src/main/java/com/yahoo/log/impl/LogUtils.java
@@ -8,7 +8,6 @@ import static com.yahoo.vespa.defaults.Defaults.getDefaults;
* @author Bjorn Borud
* @author arnej27959
* @author bjorncs
- * TODO remove "public" keyword, should be package private
*/
public class LogUtils {
public static boolean empty(String s) {