Skip to content

Commit

Permalink
[fix](bdbje) Fix bdbje logging level not work
Browse files Browse the repository at this point in the history
* `EnvironmentConfig.FILE_LOGGING_LEVEL` only set FileHandlerLevel, we should
   set logger level firstly, otherwise it will not take effect.
  • Loading branch information
SWJTU-ZhangLei committed Nov 27, 2023
1 parent baadc14 commit 5be25cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1982,7 +1982,7 @@ public class Config extends ConfigBase {
* OFF, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, ALL
*/
@ConfField
public static String bdbje_file_logging_level = "ALL";
public static String bdbje_file_logging_level = "INFO";

/**
* When holding lock time exceeds the threshold, need to report it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.logging.Level;
import java.util.stream.Collectors;

/* this class contains the reference to bdb environment.
Expand Down Expand Up @@ -139,6 +140,8 @@ public void setup(File envHome, String selfNodeName, String selfNodeHostPort,
String.valueOf(Config.bdbje_reserved_disk_bytes));

if (BDBJE_LOG_LEVEL.contains(Config.bdbje_file_logging_level)) {
java.util.logging.Logger parent = java.util.logging.Logger.getLogger("com.sleepycat.je");
parent.setLevel(Level.parse(Config.bdbje_file_logging_level));
environmentConfig.setConfigParam(EnvironmentConfig.FILE_LOGGING_LEVEL, Config.bdbje_file_logging_level);
} else {
LOG.warn("bdbje_file_logging_level invalid value: {}, will not take effort, use default",
Expand Down

0 comments on commit 5be25cc

Please sign in to comment.