diff options
author | gjoranv <gv@verizonmedia.com> | 2022-05-09 17:57:24 +0200 |
---|---|---|
committer | gjoranv <gjoranv@gmail.com> | 2022-05-10 22:28:45 +0200 |
commit | f258b373610cad2743c12d723968621265012e25 (patch) | |
tree | 2cfca6e45b6fe8bafe82db1d64b9cffd42a6ff69 /vespalog | |
parent | a8c76b68336343d25b69dfee3d2b1e93d9c50d80 (diff) |
Reapply setup of vespalog in jdisc_core (#22509)
Revert "Merge pull request #22515 from vespa-engine/revert-22509-setup-vespalog-in-jdisc_core"
Diffstat (limited to 'vespalog')
4 files changed, 27 insertions, 4 deletions
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/InitializeLog.java b/vespalog/src/main/java/com/yahoo/log/impl/InitializeLog.java new file mode 100644 index 00000000000..9b309916469 --- /dev/null +++ b/vespalog/src/main/java/com/yahoo/log/impl/InitializeLog.java @@ -0,0 +1,21 @@ +package com.yahoo.log.impl; + +import com.yahoo.log.LogSetup; + +/** + * Sets up Vespa logging. Call a setup method to set up this. + * + * @author baldersheim + */ +public class InitializeLog { + static { + LogSetup.initVespaLogging("unused-default"); + } + + /** + * Do not delete this method even if it's empty. + * Calling this methods forces this class to be loaded, + * which runs the static block. + */ + public static void init() { } +} 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) { diff --git a/vespalog/src/main/java/com/yahoo/log/impl/package-info.java b/vespalog/src/main/java/com/yahoo/log/impl/package-info.java new file mode 100644 index 00000000000..ac6fe22b9cf --- /dev/null +++ b/vespalog/src/main/java/com/yahoo/log/impl/package-info.java @@ -0,0 +1,5 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +@ExportPackage +package com.yahoo.log.impl; + +import com.yahoo.osgi.annotation.ExportPackage; |