add config option to disable rocksdb LOG file

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-04-13 17:58:13 -07:00 committed by June
parent 20efe437fb
commit 2b54c00f04
2 changed files with 11 additions and 3 deletions

View file

@ -190,6 +190,8 @@ pub struct Config {
#[serde(default = "default_rocksdb_log_level")]
pub rocksdb_log_level: String,
#[serde(default)]
pub rocksdb_log_stderr: bool,
#[serde(default = "default_rocksdb_max_log_file_size")]
pub rocksdb_max_log_file_size: usize,
#[serde(default = "default_rocksdb_log_time_to_roll")]
@ -634,14 +636,16 @@ impl fmt::Display for Config {
#[cfg(feature = "brotli_compression")]
("Brotli HTTP Compression", &self.brotli_compression.to_string()),
#[cfg(feature = "rocksdb")]
("RocksDB database log level", &self.rocksdb_log_level),
("RocksDB database LOG level", &self.rocksdb_log_level),
#[cfg(feature = "rocksdb")]
("RocksDB database log time-to-roll", &self.rocksdb_log_time_to_roll.to_string()),
("RocksDB database LOG to stderr", &self.rocksdb_log_stderr.to_string()),
#[cfg(feature = "rocksdb")]
("RocksDB database LOG time-to-roll", &self.rocksdb_log_time_to_roll.to_string()),
#[cfg(feature = "rocksdb")]
("RocksDB Max LOG Files", &self.rocksdb_max_log_files.to_string()),
#[cfg(feature = "rocksdb")]
(
"RocksDB database max log file size",
"RocksDB database max LOG file size",
&self.rocksdb_max_log_file_size.to_string(),
),
#[cfg(feature = "rocksdb")]

View file

@ -161,6 +161,10 @@ fn set_logging_defaults(opts: &mut Options, config: &Config) {
opts.set_log_file_time_to_roll(config.rocksdb_log_time_to_roll);
opts.set_keep_log_file_num(config.rocksdb_max_log_files);
opts.set_stats_dump_period_sec(0);
if config.rocksdb_log_stderr {
opts.set_stderr_logger(rocksdb_log_level, "rocksdb");
}
}
fn set_compression_defaults(opts: &mut Options, config: &Config) {