This is an automated email from the ASF dual-hosted git repository.
lhotari pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new 354cc54965 Log only overridden config in BookieServer startup (#4768)
354cc54965 is described below
commit 354cc549655d46a39abec28f29feff91e3fc3125
Author: Matteo Merli <[email protected]>
AuthorDate: Tue May 5 01:00:01 2026 -0700
Log only overridden config in BookieServer startup (#4768)
Replace the JSON dump of the entire ServerConfiguration with a
"Starting Bookie server" message that carries an "overrides" attribute
holding only the entries that differ from the built-in defaults.
---
.../org/apache/bookkeeper/proto/BookieServer.java | 37 +++++++++++++++++-----
1 file changed, 29 insertions(+), 8 deletions(-)
diff --git
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServer.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServer.java
index 30727a8f9e..2fa5e90e0b 100644
---
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServer.java
+++
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServer.java
@@ -29,6 +29,9 @@ import java.io.IOException;
import java.lang.Thread.UncaughtExceptionHandler;
import java.net.UnknownHostException;
import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
import lombok.CustomLog;
import org.apache.bookkeeper.bookie.Bookie;
import org.apache.bookkeeper.bookie.BookieCriticalThread;
@@ -36,7 +39,6 @@ import org.apache.bookkeeper.bookie.BookieException;
import org.apache.bookkeeper.bookie.BookieImpl;
import org.apache.bookkeeper.bookie.ExitCode;
import org.apache.bookkeeper.bookie.UncleanShutdownDetection;
-import org.apache.bookkeeper.common.util.JsonUtil.ParseJsonException;
import org.apache.bookkeeper.conf.ServerConfiguration;
import org.apache.bookkeeper.net.BookieId;
import org.apache.bookkeeper.net.BookieSocketAddress;
@@ -83,13 +85,9 @@ public class BookieServer {
BookieException, UnavailableException, CompatibilityException,
SecurityException {
this.conf = conf;
validateUser(conf);
- String configAsString;
- try {
- configAsString = conf.asJson();
- log.info(configAsString);
- } catch (ParseJsonException pe) {
- log.error().exception(pe).log("Got ParseJsonException while
converting Config to JSONString");
- }
+ log.info()
+ .attr("overrides", overriddenConfig(conf))
+ .log("Starting Bookie server");
this.statsLogger = statsLogger;
this.bookie = bookie;
@@ -221,6 +219,29 @@ public class BookieServer {
}
}
+ /**
+ * Returns the configuration entries that differ from the {@link
ServerConfiguration}
+ * defaults — i.e. values explicitly set by the user (via config file or
programmatically)
+ * whose value is not the same as the built-in default.
+ */
+ private static Map<String, Object> overriddenConfig(ServerConfiguration
conf) {
+ ServerConfiguration defaults = new ServerConfiguration();
+ Map<String, Object> overrides = new TreeMap<>();
+ Iterator<String> keys = conf.getInMemoryConfiguration().getKeys();
+ while (keys.hasNext()) {
+ String key = keys.next();
+ Object value = conf.getProperty(key);
+ if (value == null) {
+ continue;
+ }
+ Object defaultValue = defaults.getProperty(key);
+ if (defaultValue == null ||
!value.toString().equals(defaultValue.toString())) {
+ overrides.put(key, value);
+ }
+ }
+ return overrides;
+ }
+
public boolean isRunning() {
return bookie.isRunning() && nettyServer.isRunning() && running;