This is an automated email from the ASF dual-hosted git repository.
dheres pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-ballista.git
The following commit(s) were added to refs/heads/master by this push:
new 8d83fa24 Unified the log level configuration behavior (#386)
8d83fa24 is described below
commit 8d83fa24e4c53e97ba1147240280dbe62b53a41f
Author: r.4ntix <[email protected]>
AuthorDate: Wed Oct 19 01:18:31 2022 +0800
Unified the log level configuration behavior (#386)
Use RUST_LOG env first, if empty, use the --log-level-setting parameter
---
ballista/executor/src/main.rs | 11 +++++------
ballista/scheduler/src/main.rs | 10 +++++-----
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/ballista/executor/src/main.rs b/ballista/executor/src/main.rs
index 260a7204..54e90881 100644
--- a/ballista/executor/src/main.rs
+++ b/ballista/executor/src/main.rs
@@ -93,9 +93,10 @@ async fn main() -> Result<()> {
let grpc_port = opt.bind_grpc_port;
let log_dir = opt.log_dir;
let print_thread_info = opt.print_thread_info;
-
let scheduler_name = format!("executor_{}_{}", bind_host, port);
+ let rust_log = env::var(EnvFilter::DEFAULT_ENV);
+ let log_filter = EnvFilter::new(rust_log.unwrap_or(special_mod_log_level));
// File layer
if let Some(log_dir) = log_dir {
let log_file = tracing_appender::rolling::daily(log_dir,
&scheduler_name);
@@ -104,18 +105,16 @@ async fn main() -> Result<()> {
.with_thread_names(print_thread_info)
.with_thread_ids(print_thread_info)
.with_writer(log_file)
- .with_env_filter(special_mod_log_level)
+ .with_env_filter(log_filter)
.init();
} else {
- //Console layer
- let rust_log = env::var(EnvFilter::DEFAULT_ENV);
- let std_filter = EnvFilter::new(rust_log.unwrap_or_else(|_|
"INFO".to_string()));
+ // Console layer
tracing_subscriber::fmt()
.with_ansi(true)
.with_thread_names(print_thread_info)
.with_thread_ids(print_thread_info)
.with_writer(io::stdout)
- .with_env_filter(std_filter)
+ .with_env_filter(log_filter)
.init();
}
diff --git a/ballista/scheduler/src/main.rs b/ballista/scheduler/src/main.rs
index f2ad64ec..9b09db6a 100644
--- a/ballista/scheduler/src/main.rs
+++ b/ballista/scheduler/src/main.rs
@@ -172,6 +172,8 @@ async fn main() -> Result<()> {
format!("scheduler_{}_{}_{}", namespace, external_host, port);
let scheduler_name = format!("{}:{}", external_host, port);
+ let rust_log = env::var(EnvFilter::DEFAULT_ENV);
+ let log_filter = EnvFilter::new(rust_log.unwrap_or(special_mod_log_level));
// File layer
if let Some(log_dir) = log_dir {
let log_file = tracing_appender::rolling::daily(log_dir,
&log_file_name_prefix);
@@ -180,18 +182,16 @@ async fn main() -> Result<()> {
.with_thread_names(print_thread_info)
.with_thread_ids(print_thread_info)
.with_writer(log_file)
- .with_env_filter(special_mod_log_level)
+ .with_env_filter(log_filter)
.init();
} else {
- //Console layer
- let rust_log = env::var(EnvFilter::DEFAULT_ENV);
- let std_filter = EnvFilter::new(rust_log.unwrap_or_else(|_|
"INFO".to_string()));
+ // Console layer
tracing_subscriber::fmt()
.with_ansi(true)
.with_thread_names(print_thread_info)
.with_thread_ids(print_thread_info)
.with_writer(io::stdout)
- .with_env_filter(std_filter)
+ .with_env_filter(log_filter)
.init();
}