diff --git a/ballista/rust/executor/executor_config_spec.toml b/ballista/rust/executor/executor_config_spec.toml index 86e712bda..4dcfc6701 100644 --- a/ballista/rust/executor/executor_config_spec.toml +++ b/ballista/rust/executor/executor_config_spec.toml @@ -101,4 +101,10 @@ default = "604800" name = "plugin_dir" type = "String" doc = "plugin dir" -default = "std::string::String::from(\"\")" \ No newline at end of file +default = "std::string::String::from(\"\")" + +[[param]] +name = "log_level_setting" +type = "String" +doc = "special log level for sub mod. link: https://docs.rs/env_logger/latest/env_logger/#enabling-logging. For example we want whole level is INFO but datafusion mode is DEBUG" +default = "std::string::String::from(\"INFO, datafusion=INFO\")" diff --git a/ballista/rust/executor/src/main.rs b/ballista/rust/executor/src/main.rs index 2f5c686de..6a87be776 100644 --- a/ballista/rust/executor/src/main.rs +++ b/ballista/rust/executor/src/main.rs @@ -63,8 +63,6 @@ static ALLOC: snmalloc_rs::SnMalloc = snmalloc_rs::SnMalloc; #[tokio::main] async fn main() -> Result<()> { - env_logger::init(); - // parse command-line arguments let (opt, _remaining_args) = Config::including_optional_config_files(&["/etc/ballista/executor.toml"]) @@ -75,6 +73,12 @@ async fn main() -> Result<()> { std::process::exit(0); } + let special_mod_log_level = opt.log_level_setting; + env_logger::builder() + .parse_filters(&*special_mod_log_level) + .format_timestamp_millis() + .init(); + let external_host = opt.external_host; let bind_host = opt.bind_host; let port = opt.bind_port; diff --git a/ballista/rust/scheduler/scheduler_config_spec.toml b/ballista/rust/scheduler/scheduler_config_spec.toml index d06b523b6..cff529d52 100644 --- a/ballista/rust/scheduler/scheduler_config_spec.toml +++ b/ballista/rust/scheduler/scheduler_config_spec.toml @@ -76,4 +76,10 @@ default = "std::string::String::from(\"\")" name = "sled_dir" type = "String" doc = "Sled dir: Opens a Db for saving schduler metadata at the specified path. This will create a new storage directory at the specified path if it does not already exist." -default = "std::string::String::from(\"\")" \ No newline at end of file +default = "std::string::String::from(\"\")" + +[[param]] +name = "log_level_setting" +type = "String" +doc = "special log level for sub mod. link: https://docs.rs/env_logger/latest/env_logger/#enabling-logging. For example we want whole level is INFO but datafusion mode is DEBUG" +default = "std::string::String::from(\"INFO, datafusion=INFO\")" diff --git a/ballista/rust/scheduler/src/main.rs b/ballista/rust/scheduler/src/main.rs index a83353147..61e4ae360 100644 --- a/ballista/rust/scheduler/src/main.rs +++ b/ballista/rust/scheduler/src/main.rs @@ -146,8 +146,6 @@ async fn start_server( #[tokio::main] async fn main() -> Result<()> { - env_logger::init(); - // parse options let (opt, _remaining_args) = Config::including_optional_config_files(&["/etc/ballista/scheduler.toml"]) @@ -158,6 +156,12 @@ async fn main() -> Result<()> { std::process::exit(0); } + let special_mod_log_level = opt.log_level_setting; + env_logger::builder() + .parse_filters(&*special_mod_log_level) + .format_timestamp_millis() + .init(); + let namespace = opt.namespace; let bind_host = opt.bind_host; let port = opt.bind_port;