diff --git a/bench-exchange/tests/bench_exchange.rs b/bench-exchange/tests/bench_exchange.rs index 7ddcc057d..bb032c2bd 100644 --- a/bench-exchange/tests/bench_exchange.rs +++ b/bench-exchange/tests/bench_exchange.rs @@ -5,7 +5,7 @@ use solana_core::validator::ValidatorConfig; use solana_exchange_program::exchange_processor::process_instruction; use solana_exchange_program::id; use solana_exchange_program::solana_exchange_program; -use solana_faucet::faucet::run_local_faucet; +use solana_faucet::faucet::run_local_faucet_with_port; use solana_local_cluster::local_cluster::{ClusterConfig, LocalCluster}; use solana_runtime::bank::Bank; use solana_runtime::bank_client::BankClient; @@ -57,8 +57,11 @@ fn test_exchange_local_cluster() { ); let (addr_sender, addr_receiver) = channel(); - run_local_faucet(faucet_keypair, addr_sender, Some(1_000_000_000_000)); - let faucet_addr = addr_receiver.recv_timeout(Duration::from_secs(2)).unwrap(); + run_local_faucet_with_port(faucet_keypair, addr_sender, Some(1_000_000_000_000), 0); + let faucet_addr = addr_receiver + .recv_timeout(Duration::from_secs(2)) + .expect("run_local_faucet") + .expect("faucet_addr"); info!("Connecting to the cluster"); let nodes = diff --git a/bench-tps/tests/bench_tps.rs b/bench-tps/tests/bench_tps.rs index c3b3b046a..a97cb2901 100644 --- a/bench-tps/tests/bench_tps.rs +++ b/bench-tps/tests/bench_tps.rs @@ -4,7 +4,7 @@ use solana_bench_tps::cli::Config; use solana_client::thin_client::create_client; use solana_core::cluster_info::VALIDATOR_PORT_RANGE; use solana_core::validator::ValidatorConfig; -use solana_faucet::faucet::run_local_faucet; +use solana_faucet::faucet::run_local_faucet_with_port; use solana_local_cluster::local_cluster::{ClusterConfig, LocalCluster}; use solana_sdk::signature::{Keypair, Signer}; use std::sync::{mpsc::channel, Arc}; @@ -36,8 +36,11 @@ fn test_bench_tps_local_cluster(config: Config) { )); let (addr_sender, addr_receiver) = channel(); - run_local_faucet(faucet_keypair, addr_sender, None); - let faucet_addr = addr_receiver.recv_timeout(Duration::from_secs(2)).unwrap(); + run_local_faucet_with_port(faucet_keypair, addr_sender, None, 0); + let faucet_addr = addr_receiver + .recv_timeout(Duration::from_secs(2)) + .expect("run_local_faucet") + .expect("faucet_addr"); let lamports_per_account = 100; diff --git a/cli/tests/nonce.rs b/cli/tests/nonce.rs index 81e9197d7..b3cc3fbed 100644 --- a/cli/tests/nonce.rs +++ b/cli/tests/nonce.rs @@ -18,7 +18,6 @@ use solana_sdk::{ signature::{keypair_from_seed, Keypair, Signer}, system_program, }; -use std::sync::mpsc::channel; #[test] fn test_nonce() { @@ -59,9 +58,7 @@ fn full_battery_tests( seed: Option, use_nonce_authority: bool, ) { - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let rpc_client = RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed()); @@ -219,9 +216,7 @@ fn test_create_account_with_seed() { let mint_keypair = Keypair::new(); let test_validator = TestValidator::with_custom_fees(mint_keypair.pubkey(), 1); - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let offline_nonce_authority_signer = keypair_from_seed(&[1u8; 32]).unwrap(); let online_nonce_creator_signer = keypair_from_seed(&[2u8; 32]).unwrap(); diff --git a/cli/tests/program.rs b/cli/tests/program.rs index 3413afc5c..356981d12 100644 --- a/cli/tests/program.rs +++ b/cli/tests/program.rs @@ -14,7 +14,7 @@ use solana_sdk::{ pubkey::Pubkey, signature::{Keypair, Signer}, }; -use std::{fs::File, io::Read, path::PathBuf, str::FromStr, sync::mpsc::channel}; +use std::{fs::File, io::Read, path::PathBuf, str::FromStr}; #[test] fn test_cli_program_deploy_non_upgradeable() { @@ -28,10 +28,7 @@ fn test_cli_program_deploy_non_upgradeable() { let mint_keypair = Keypair::new(); let test_validator = TestValidator::with_no_fees(mint_keypair.pubkey()); - - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let rpc_client = RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed()); @@ -149,10 +146,7 @@ fn test_cli_program_deploy_no_authority() { let mint_keypair = Keypair::new(); let test_validator = TestValidator::with_no_fees(mint_keypair.pubkey()); - - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let rpc_client = RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed()); @@ -237,10 +231,7 @@ fn test_cli_program_deploy_with_authority() { let mint_keypair = Keypair::new(); let test_validator = TestValidator::with_no_fees(mint_keypair.pubkey()); - - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let rpc_client = RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed()); @@ -568,10 +559,7 @@ fn test_cli_program_write_buffer() { let mint_keypair = Keypair::new(); let test_validator = TestValidator::with_no_fees(mint_keypair.pubkey()); - - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let rpc_client = RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed()); @@ -823,10 +811,7 @@ fn test_cli_program_set_buffer_authority() { let mint_keypair = Keypair::new(); let test_validator = TestValidator::with_no_fees(mint_keypair.pubkey()); - - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let rpc_client = RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed()); diff --git a/cli/tests/request_airdrop.rs b/cli/tests/request_airdrop.rs index 4c75cdac4..38d957065 100644 --- a/cli/tests/request_airdrop.rs +++ b/cli/tests/request_airdrop.rs @@ -6,16 +6,13 @@ use solana_sdk::{ commitment_config::CommitmentConfig, signature::{Keypair, Signer}, }; -use std::sync::mpsc::channel; #[test] fn test_cli_request_airdrop() { let mint_keypair = Keypair::new(); let test_validator = TestValidator::with_no_fees(mint_keypair.pubkey()); - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let mut bob_config = CliConfig::recent_for_tests(); bob_config.json_rpc_url = test_validator.rpc_url(); diff --git a/cli/tests/stake.rs b/cli/tests/stake.rs index b9af88ef3..4a425e39e 100644 --- a/cli/tests/stake.rs +++ b/cli/tests/stake.rs @@ -22,15 +22,12 @@ use solana_stake_program::{ stake_instruction::LockupArgs, stake_state::{Lockup, StakeAuthorize, StakeState}, }; -use std::sync::mpsc::channel; #[test] fn test_stake_delegation_force() { let mint_keypair = Keypair::new(); let test_validator = TestValidator::with_no_fees(mint_keypair.pubkey()); - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let rpc_client = RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed()); @@ -117,9 +114,7 @@ fn test_seed_stake_delegation_and_deactivation() { let mint_keypair = Keypair::new(); let test_validator = TestValidator::with_no_fees(mint_keypair.pubkey()); - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let rpc_client = RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed()); @@ -197,9 +192,7 @@ fn test_stake_delegation_and_deactivation() { let mint_keypair = Keypair::new(); let test_validator = TestValidator::with_no_fees(mint_keypair.pubkey()); - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let rpc_client = RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed()); @@ -273,9 +266,7 @@ fn test_offline_stake_delegation_and_deactivation() { let mint_keypair = Keypair::new(); let test_validator = TestValidator::with_no_fees(mint_keypair.pubkey()); - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let rpc_client = RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed()); @@ -406,9 +397,7 @@ fn test_nonced_stake_delegation_and_deactivation() { let mint_keypair = Keypair::new(); let test_validator = TestValidator::with_no_fees(mint_keypair.pubkey()); - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let rpc_client = RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed()); @@ -521,9 +510,7 @@ fn test_stake_authorize() { let mint_keypair = Keypair::new(); let test_validator = TestValidator::with_no_fees(mint_keypair.pubkey()); - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let rpc_client = RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed()); @@ -778,9 +765,7 @@ fn test_stake_authorize_with_fee_payer() { let mint_keypair = Keypair::new(); let test_validator = TestValidator::with_custom_fees(mint_keypair.pubkey(), SIG_FEE); - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let rpc_client = RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed()); @@ -903,9 +888,7 @@ fn test_stake_split() { let mint_keypair = Keypair::new(); let test_validator = TestValidator::with_custom_fees(mint_keypair.pubkey(), 1); - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let rpc_client = RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed()); @@ -1047,9 +1030,7 @@ fn test_stake_set_lockup() { let mint_keypair = Keypair::new(); let test_validator = TestValidator::with_custom_fees(mint_keypair.pubkey(), 1); - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let rpc_client = RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed()); @@ -1299,9 +1280,7 @@ fn test_offline_nonced_create_stake_account_and_withdraw() { let mint_keypair = Keypair::new(); let test_validator = TestValidator::with_no_fees(mint_keypair.pubkey()); - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let rpc_client = RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed()); diff --git a/cli/tests/transfer.rs b/cli/tests/transfer.rs index c6c2d6e65..54bc2fd4a 100644 --- a/cli/tests/transfer.rs +++ b/cli/tests/transfer.rs @@ -17,17 +17,13 @@ use solana_sdk::{ pubkey::Pubkey, signature::{keypair_from_seed, Keypair, NullSigner, Signer}, }; -use std::sync::mpsc::channel; #[test] fn test_transfer() { solana_logger::setup(); let mint_keypair = Keypair::new(); let test_validator = TestValidator::with_custom_fees(mint_keypair.pubkey(), 1); - - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let rpc_client = RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed()); @@ -242,10 +238,7 @@ fn test_transfer_multisession_signing() { solana_logger::setup(); let mint_keypair = Keypair::new(); let test_validator = TestValidator::with_custom_fees(mint_keypair.pubkey(), 1); - - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let to_pubkey = Pubkey::new(&[1u8; 32]); let offline_from_signer = keypair_from_seed(&[2u8; 32]).unwrap(); @@ -359,10 +352,7 @@ fn test_transfer_all() { solana_logger::setup(); let mint_keypair = Keypair::new(); let test_validator = TestValidator::with_custom_fees(mint_keypair.pubkey(), 1); - - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let rpc_client = RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed()); diff --git a/cli/tests/vote.rs b/cli/tests/vote.rs index 968ec54a0..6639c7560 100644 --- a/cli/tests/vote.rs +++ b/cli/tests/vote.rs @@ -15,15 +15,12 @@ use solana_sdk::{ signature::{Keypair, Signer}, }; use solana_vote_program::vote_state::{VoteAuthorize, VoteState, VoteStateVersions}; -use std::sync::mpsc::channel; #[test] fn test_vote_authorize_and_withdraw() { let mint_keypair = Keypair::new(); let test_validator = TestValidator::with_no_fees(mint_keypair.pubkey()); - let (sender, receiver) = channel(); - run_local_faucet(mint_keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(mint_keypair, None); let rpc_client = RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed()); diff --git a/faucet/src/faucet.rs b/faucet/src/faucet.rs index 0de8109de..ea3ebc28e 100644 --- a/faucet/src/faucet.rs +++ b/faucet/src/faucet.rs @@ -265,9 +265,9 @@ pub fn request_airdrop_transaction( pub fn run_local_faucet_with_port( faucet_keypair: Keypair, - sender: Sender, + sender: Sender>, per_time_cap: Option, - port: u16, + port: u16, // 0 => auto assign ) { thread::spawn(move || { let faucet_addr = socketaddr!(0, port); @@ -283,23 +283,41 @@ pub fn run_local_faucet_with_port( } // For integration tests. Listens on random open port and reports port to Sender. -pub fn run_local_faucet( - faucet_keypair: Keypair, - sender: Sender, - per_time_cap: Option, -) { - run_local_faucet_with_port(faucet_keypair, sender, per_time_cap, 0) +pub fn run_local_faucet(faucet_keypair: Keypair, per_time_cap: Option) -> SocketAddr { + let (sender, receiver) = std::sync::mpsc::channel(); + run_local_faucet_with_port(faucet_keypair, sender, per_time_cap, 0); + receiver + .recv() + .expect("run_local_faucet") + .expect("faucet_addr") } pub async fn run_faucet( faucet: Arc>, faucet_addr: SocketAddr, - send_addr: Option>, + sender: Option>>, ) { - let listener = TcpListener::bind(&faucet_addr).await.unwrap(); - if let Some(send_addr) = send_addr { - send_addr.send(listener.local_addr().unwrap()).unwrap(); + let listener = TcpListener::bind(&faucet_addr).await; + if let Some(sender) = sender { + sender.send( + listener.as_ref().map(|listener| listener.local_addr().unwrap()) + .map_err(|err| { + format!( + "Unable to bind faucet to {:?}, check the address is not already in use: {}", + faucet_addr, err + ) + }) + ) + .unwrap(); } + + let listener = match listener { + Err(err) => { + error!("Faucet failed to start: {}", err); + return; + } + Ok(listener) => listener, + }; info!("Faucet started. Listening on: {}", faucet_addr); info!( "Faucet account address: {}", diff --git a/faucet/tests/local-faucet.rs b/faucet/tests/local-faucet.rs index 28ec2f02f..841255274 100644 --- a/faucet/tests/local-faucet.rs +++ b/faucet/tests/local-faucet.rs @@ -6,7 +6,6 @@ use solana_sdk::{ system_instruction, transaction::Transaction, }; -use std::sync::mpsc::channel; #[test] fn test_local_faucet() { @@ -18,9 +17,7 @@ fn test_local_faucet() { let message = Message::new(&[create_instruction], Some(&keypair.pubkey())); let expected_tx = Transaction::new(&[&keypair], message, blockhash); - let (sender, receiver) = channel(); - run_local_faucet(keypair, sender, None); - let faucet_addr = receiver.recv().unwrap(); + let faucet_addr = run_local_faucet(keypair, None); let result = request_airdrop_transaction(&faucet_addr, &to, lamports, blockhash); assert_eq!(expected_tx, result.unwrap()); diff --git a/validator/src/bin/solana-test-validator.rs b/validator/src/bin/solana-test-validator.rs index fb720fc97..1d09b3187 100644 --- a/validator/src/bin/solana-test-validator.rs +++ b/validator/src/bin/solana-test-validator.rs @@ -23,7 +23,7 @@ use { signature::{read_keypair_file, write_keypair_file, Keypair, Signer}, system_program, }, - solana_validator::{start_logger, test_validator::*}, + solana_validator::{redirect_stderr_to_file, test_validator::*}, std::{ collections::HashSet, fs, io, @@ -228,13 +228,13 @@ fn main() { match address_program { [address, program] => { let address = address.parse::().unwrap_or_else(|err| { - eprintln!("Error: invalid address {}: {}", address, err); + println!("Error: invalid address {}: {}", address, err); exit(1); }); let program_path = PathBuf::from(program); if !program_path.exists() { - eprintln!( + println!( "Error: program file does not exist: {}", program_path.display() ); @@ -261,12 +261,12 @@ fn main() { Some(_) => value_t_or_exit!(matches, "warp_slot", Slot), None => { cluster_rpc_client.as_ref().unwrap_or_else(|_| { - eprintln!("The --url argument must be provided if --warp-slot/-w is used without an explicit slot"); + println!("The --url argument must be provided if --warp-slot/-w is used without an explicit slot"); exit(1); }).get_slot() .unwrap_or_else(|err| { - eprintln!("Unable to get current cluster slot: {}", err); + println!("Unable to get current cluster slot: {}", err); exit(1); }) } @@ -277,7 +277,7 @@ fn main() { if !ledger_path.exists() { fs::create_dir(&ledger_path).unwrap_or_else(|err| { - eprintln!( + println!( "Error: Unable to create directory {}: {}", ledger_path.display(), err @@ -288,7 +288,7 @@ fn main() { let mut ledger_fd_lock = FdLock::new(fs::File::open(&ledger_path).unwrap()); let _ledger_lock = ledger_fd_lock.try_lock().unwrap_or_else(|_| { - eprintln!( + println!( "Error: Unable to lock {} directory. Check if another solana-test-validator is running", ledger_path.display() ); @@ -297,7 +297,7 @@ fn main() { if reset_ledger { remove_directory_contents(&ledger_path).unwrap_or_else(|err| { - eprintln!("Error: Unable to remove {}: {}", ledger_path.display(), err); + println!("Error: Unable to remove {}: {}", ledger_path.display(), err); exit(1); }) } @@ -326,14 +326,14 @@ fn main() { } else { None }; - let _logger_thread = start_logger(logfile); + let _logger_thread = redirect_stderr_to_file(logfile); let faucet_lamports = sol_to_lamports(1_000_000.); let faucet_keypair_file = ledger_path.join("faucet-keypair.json"); if !faucet_keypair_file.exists() { write_keypair_file(&Keypair::new(), faucet_keypair_file.to_str().unwrap()).unwrap_or_else( |err| { - eprintln!( + println!( "Error: Failed to write {}: {}", faucet_keypair_file.display(), err @@ -344,7 +344,7 @@ fn main() { } let faucet_keypair = read_keypair_file(faucet_keypair_file.to_str().unwrap()).unwrap_or_else(|err| { - eprintln!( + println!( "Error: Failed to read {}: {}", faucet_keypair_file.display(), err @@ -397,14 +397,17 @@ fn main() { genesis.start_with_mint_address(mint_address) } .unwrap_or_else(|err| { - eprintln!("Error: failed to start validator: {}", err); + println!("Error: failed to start validator: {}", err); exit(1); }); if let Some(faucet_addr) = &faucet_addr { let (sender, receiver) = channel(); run_local_faucet_with_port(faucet_keypair, sender, None, faucet_addr.port()); - receiver.recv().expect("run faucet"); + let _ = receiver.recv().expect("run faucet").unwrap_or_else(|err| { + println!("Error: failed to start faucet: {}", err); + exit(1); + }); } if output == Output::Dashboard { diff --git a/validator/src/lib.rs b/validator/src/lib.rs index 63f161778..e9793281e 100644 --- a/validator/src/lib.rs +++ b/validator/src/lib.rs @@ -20,7 +20,10 @@ fn redirect_stderr(filename: &str) { } } -pub fn start_logger(logfile: Option) -> Option> { +// Redirect stderr to a file with support for logrotate by sending a SIGUSR1 to the process. +// +// Upon success, future `log` macros and `eprintln!()` can be found in the specified log file. +pub fn redirect_stderr_to_file(logfile: Option) -> Option> { // Default to RUST_BACKTRACE=1 for more informative validator logs if env::var_os("RUST_BACKTRACE").is_none() { env::set_var("RUST_BACKTRACE", "1") diff --git a/validator/src/main.rs b/validator/src/main.rs index c71840773..34ad00eb4 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -41,7 +41,7 @@ use solana_sdk::{ pubkey::Pubkey, signature::{Keypair, Signer}, }; -use solana_validator::start_logger; +use solana_validator::redirect_stderr_to_file; use std::{ collections::HashSet, env, @@ -1809,7 +1809,7 @@ pub fn main() { } }; let use_progress_bar = logfile.is_none(); - let _logger_thread = start_logger(logfile); + let _logger_thread = redirect_stderr_to_file(logfile); info!("{} {}", crate_name!(), solana_version::version!()); info!("Starting validator with: {:#?}", std::env::args_os());