You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ag...@apache.org on 2022/07/28 21:48:24 UTC

[arrow-ballista] branch master updated: Add config for log level in ballista (#103)

This is an automated email from the ASF dual-hosted git repository.

agrove 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 315f4198 Add config for log level in ballista (#103)
315f4198 is described below

commit 315f41981c41324d055f29e524c9f60947995a7f
Author: Yang Jiang <ya...@ebay.com>
AuthorDate: Fri Jul 29 05:48:19 2022 +0800

    Add config for log level in ballista (#103)
---
 ballista/rust/executor/executor_config_spec.toml   | 8 +++++++-
 ballista/rust/executor/src/main.rs                 | 8 ++++++--
 ballista/rust/scheduler/scheduler_config_spec.toml | 8 +++++++-
 ballista/rust/scheduler/src/main.rs                | 8 ++++++--
 4 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/ballista/rust/executor/executor_config_spec.toml b/ballista/rust/executor/executor_config_spec.toml
index 86e712bd..4dcfc670 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 2f5c686d..6a87be77 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 d06b523b..cff529d5 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 a8335314..61e4ae36 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;