Skip to content

Commit 7582527

Browse files
committed
fix: replace default storage dir with configured dir for LogWriterConfig::File
1 parent a23344d commit 7582527

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/builder.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,7 @@ fn build_with_store_internal(
13221322
fn setup_logger(
13231323
log_writer_conf: &Option<LogWriterConfig>, node_conf: &Config,
13241324
) -> Result<Arc<Logger>, BuildError> {
1325+
let is_default = log_writer_conf.is_none();
13251326
let default_lw_config = LogWriterConfig::default();
13261327
let log_writer_config =
13271328
if let Some(conf) = log_writer_conf { conf } else { &default_lw_config };
@@ -1330,7 +1331,9 @@ fn setup_logger(
13301331
LogWriterConfig::File { log_file_path, log_level } => {
13311332
let fp = DEFAULT_LOG_FILE_PATH
13321333
.replace(DEFAULT_STORAGE_DIR_PATH, &node_conf.storage_dir_path);
1333-
let log_file_path = log_file_path.as_ref().map(|p| p.as_str()).unwrap_or(&fp);
1334+
let log_file_path =
1335+
if is_default { &fp } else { log_file_path.as_ref().map(|p| p).unwrap_or(&fp) };
1336+
13341337
let log_level = log_level.unwrap_or(DEFAULT_LOG_LEVEL);
13351338

13361339
Logger::new_fs_writer(log_file_path, log_level)

0 commit comments

Comments
 (0)