Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config for log level in ballista #103

Merged
merged 2 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ballista/rust/executor/executor_config_spec.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,10 @@ default = "604800"
name = "plugin_dir"
type = "String"
doc = "plugin dir"
default = "std::string::String::from(\"\")"
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\")"
8 changes: 6 additions & 2 deletions ballista/rust/executor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand All @@ -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;
Expand Down
8 changes: 7 additions & 1 deletion ballista/rust/scheduler/scheduler_config_spec.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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(\"\")"
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\")"
8 changes: 6 additions & 2 deletions ballista/rust/scheduler/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand All @@ -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;
Expand Down