diff --git a/accounts-cluster-bench/src/main.rs b/accounts-cluster-bench/src/main.rs index 9e592131a16905..2135e9ee19cbee 100644 --- a/accounts-cluster-bench/src/main.rs +++ b/accounts-cluster-bench/src/main.rs @@ -486,7 +486,7 @@ fn run_accounts_bench( } fn main() { - solana_logger::setup_with_default("solana=info"); + solana_logger::setup_with_default_filter(); let matches = App::new(crate_name!()) .about(crate_description!()) .version(solana_version::version!()) diff --git a/bench-tps/src/main.rs b/bench-tps/src/main.rs index 519612bd4237a7..e9cc2100635912 100644 --- a/bench-tps/src/main.rs +++ b/bench-tps/src/main.rs @@ -221,7 +221,7 @@ fn create_client( } fn main() { - solana_logger::setup_with_default("solana=info"); + solana_logger::setup_with_default_filter(); solana_metrics::set_panic_hook("bench-tps", /*version:*/ None); let matches = cli::build_args(solana_version::version!()).get_matches(); diff --git a/dos/src/main.rs b/dos/src/main.rs index 8e6c3c5b2b11b5..6a7968669f4c55 100644 --- a/dos/src/main.rs +++ b/dos/src/main.rs @@ -755,7 +755,7 @@ fn run_dos( } fn main() { - solana_logger::setup_with_default("solana=info"); + solana_logger::setup_with_default_filter(); let cmd_params = build_cli_parameters(); let (nodes, client) = if !cmd_params.skip_gossip { diff --git a/faucet/src/bin/faucet.rs b/faucet/src/bin/faucet.rs index 8e45ef98155a54..56cc7542623185 100644 --- a/faucet/src/bin/faucet.rs +++ b/faucet/src/bin/faucet.rs @@ -19,7 +19,7 @@ use { async fn main() { let default_keypair = solana_cli_config::Config::default().keypair_path; - solana_logger::setup_with_default("solana=info"); + solana_logger::setup_with_default_filter(); solana_metrics::set_panic_hook("faucet", /*version:*/ None); let matches = App::new(crate_name!()) .about(crate_description!()) diff --git a/gossip/src/main.rs b/gossip/src/main.rs index 226fab8d9d43a8..1f31195f431d36 100644 --- a/gossip/src/main.rs +++ b/gossip/src/main.rs @@ -326,7 +326,7 @@ fn process_rpc_url( } fn main() -> Result<(), Box> { - solana_logger::setup_with_default("solana=info"); + solana_logger::setup_with_default_filter(); let matches = parse_matches(); let socket_addr_space = SocketAddrSpace::new(matches.is_present("allow_private_addr")); diff --git a/ledger-tool/src/main.rs b/ledger-tool/src/main.rs index aeed15fc9c9bbf..f7b25ec279636c 100644 --- a/ledger-tool/src/main.rs +++ b/ledger-tool/src/main.rs @@ -1081,7 +1081,7 @@ fn main() { const DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN: usize = std::usize::MAX; const DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN: usize = std::usize::MAX; - solana_logger::setup_with_default("solana=info"); + solana_logger::setup_with_default_filter(); let starting_slot_arg = Arg::with_name("starting_slot") .long("starting-slot") diff --git a/logger/src/lib.rs b/logger/src/lib.rs index 7b9ae30d881053..aa8dc5ca1db0ef 100644 --- a/logger/src/lib.rs +++ b/logger/src/lib.rs @@ -10,6 +10,8 @@ lazy_static! { Arc::new(RwLock::new(env_logger::Logger::from_default_env())); } +pub const DEFAULT_FILTER: &str = "solana=info,agave=info"; + struct LoggerShim {} impl log::Log for LoggerShim { @@ -49,6 +51,11 @@ pub fn setup_with_default(filter: &str) { replace_logger(logger); } +// Configures logging with the `DEFAULT_FILTER` if RUST_LOG is not set +pub fn setup_with_default_filter() { + setup_with_default(DEFAULT_FILTER); +} + // Configures logging with the default filter "error" if RUST_LOG is not set pub fn setup() { setup_with_default("error"); diff --git a/runtime/store-tool/src/main.rs b/runtime/store-tool/src/main.rs index 98140ed59ba0ea..8c2cf80148882d 100644 --- a/runtime/store-tool/src/main.rs +++ b/runtime/store-tool/src/main.rs @@ -11,7 +11,7 @@ use { }; fn main() { - solana_logger::setup_with_default("solana=info"); + solana_logger::setup_with_default_filter(); let matches = App::new(crate_name!()) .about(crate_description!()) .version(solana_version::version!()) diff --git a/scripts/run.sh b/scripts/run.sh index 2d8e1ec88ac450..70994c921f47ac 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -37,7 +37,7 @@ $ok || { exit 1 } -export RUST_LOG=${RUST_LOG:-solana=info,solana_runtime::message_processor=debug} # if RUST_LOG is unset, default to info +export RUST_LOG=${RUST_LOG:-solana=info,agave=info,solana_runtime::message_processor=debug} # if RUST_LOG is unset, default to info export RUST_BACKTRACE=1 dataDir=$PWD/config/"$(basename "$0" .sh)" ledgerDir=$PWD/config/ledger diff --git a/transaction-dos/src/main.rs b/transaction-dos/src/main.rs index 5d69e9e291b6b5..11f8548227cb58 100644 --- a/transaction-dos/src/main.rs +++ b/transaction-dos/src/main.rs @@ -425,7 +425,7 @@ fn run_transactions_dos( } fn main() { - solana_logger::setup_with_default("solana=info"); + solana_logger::setup_with_default_filter(); let matches = App::new(crate_name!()) .about(crate_description!()) .version(solana_version::version!()) diff --git a/validator/src/lib.rs b/validator/src/lib.rs index 4e7ed43ec78309..fab90fa98e06ca 100644 --- a/validator/src/lib.rs +++ b/validator/src/lib.rs @@ -46,10 +46,9 @@ pub fn redirect_stderr_to_file(logfile: Option) -> Option env::set_var("RUST_BACKTRACE", "1") } - let filter = "solana=info"; match logfile { None => { - solana_logger::setup_with_default(filter); + solana_logger::setup_with_default_filter(); None } Some(logfile) => { @@ -63,7 +62,7 @@ pub fn redirect_stderr_to_file(logfile: Option) -> Option exit(1); }); - solana_logger::setup_with_default(filter); + solana_logger::setup_with_default_filter(); redirect_stderr(&logfile); Some( std::thread::Builder::new() diff --git a/watchtower/src/main.rs b/watchtower/src/main.rs index 341b7903c0a33e..11dd70e27285dc 100644 --- a/watchtower/src/main.rs +++ b/watchtower/src/main.rs @@ -246,7 +246,7 @@ fn get_cluster_info( } fn main() -> Result<(), Box> { - solana_logger::setup_with_default("solana=info"); + solana_logger::setup_with_default_filter(); solana_metrics::set_panic_hook("watchtower", /*version:*/ None); let config = get_config();