diff --git a/Cargo.lock b/Cargo.lock index e89bcdbdbffa..80aeebcb0389 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6228,6 +6228,16 @@ dependencies = [ "syn 2.0.58", ] +[[package]] +name = "env_filter" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" +dependencies = [ + "log", + "regex", +] + [[package]] name = "env_logger" version = "0.10.2" @@ -9753,6 +9763,7 @@ dependencies = [ "anyhow", "colored", "crossbeam-channel", + "env_filter", "fastrace", "jiff", "log", diff --git a/src/common/tracing/Cargo.toml b/src/common/tracing/Cargo.toml index 822411af6cac..bb3b6c050903 100644 --- a/src/common/tracing/Cargo.toml +++ b/src/common/tracing/Cargo.toml @@ -28,6 +28,7 @@ logforth = { version = "0.12", features = [ 'rolling_file', 'opentelemetry', 'fastrace', + "env-filter", ] } opentelemetry = { workspace = true } opentelemetry-otlp = { workspace = true } diff --git a/src/common/tracing/src/init.rs b/src/common/tracing/src/init.rs index 93b5793dfdea..1b66f0c51939 100644 --- a/src/common/tracing/src/init.rs +++ b/src/common/tracing/src/init.rs @@ -22,7 +22,9 @@ use databend_common_base::runtime::Thread; use fastrace::prelude::*; use log::LevelFilter; use log::Metadata; +use logforth::filter::env::EnvFilterBuilder; use logforth::filter::CustomFilter; +use logforth::filter::EnvFilter; use logforth::filter::FilterResult; use logforth::filter::TargetFilter; use logforth::Dispatch; @@ -213,7 +215,9 @@ pub fn init_logging( "databend::log::structlog", LevelFilter::Off, )) - .filter(cfg.stderr.level.parse().unwrap_or(LevelFilter::Info)) + .filter(EnvFilter::new( + EnvFilterBuilder::new().parse(&cfg.stderr.level), + )) .layout(get_layout(&cfg.stderr.format)) .append(logforth::append::Stderr); logger = logger.dispatch(dispatch); diff --git a/src/query/storages/hive/hive/src/hive_table.rs b/src/query/storages/hive/hive/src/hive_table.rs index b2cebe6058f3..fa728e47c226 100644 --- a/src/query/storages/hive/hive/src/hive_table.rs +++ b/src/query/storages/hive/hive/src/hive_table.rs @@ -615,7 +615,7 @@ async fn do_list_files_from_dir( continue; } // Ignore the location itself - if path.trim_end_matches('/') == location.trim_end_matches('/') { + if path.trim_matches('/') == location.trim_matches('/') { continue; }