Skip to content

Commit

Permalink
[anza migration]: add 'agave=info' to default log level (solana-labs#223
Browse files Browse the repository at this point in the history
)
  • Loading branch information
yihau authored Mar 14, 2024
1 parent 72d6d78 commit 51dc7e6
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion accounts-db/store-tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,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!())
Expand Down
2 changes: 1 addition & 1 deletion bench-tps/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,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();
Expand Down
2 changes: 1 addition & 1 deletion cargo-registry/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ impl CargoRegistryService {

#[tokio::main]
async fn main() {
solana_logger::setup_with_default("solana=info");
solana_logger::setup_with_default_filter();
let client = Arc::new(Client::new().expect("Failed to get RPC Client instance"));

let bind_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), client.port);
Expand Down
2 changes: 1 addition & 1 deletion dos/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ fn run_dos<T: 'static + BenchTpsClient + Send + Sync>(
}

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 {
Expand Down
2 changes: 1 addition & 1 deletion faucet/src/bin/faucet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!())
Expand Down
2 changes: 1 addition & 1 deletion gossip/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ fn process_rpc_url(
}

fn main() -> Result<(), Box<dyn error::Error>> {
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"));
Expand Down
2 changes: 1 addition & 1 deletion ledger-tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,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 no_snapshot_arg = Arg::with_name("no_snapshot")
.long("no-snapshot")
Expand Down
7 changes: 7 additions & 0 deletions logger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion transaction-dos/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,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!())
Expand Down
5 changes: 2 additions & 3 deletions validator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ pub fn redirect_stderr_to_file(logfile: Option<String>) -> Option<JoinHandle<()>
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) => {
Expand All @@ -58,7 +57,7 @@ pub fn redirect_stderr_to_file(logfile: Option<String>) -> Option<JoinHandle<()>
exit(1);
});

solana_logger::setup_with_default(filter);
solana_logger::setup_with_default_filter();
redirect_stderr(&logfile);
Some(
std::thread::Builder::new()
Expand Down
2 changes: 1 addition & 1 deletion watchtower/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ fn get_cluster_info(
}

fn main() -> Result<(), Box<dyn error::Error>> {
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();
Expand Down

0 comments on commit 51dc7e6

Please sign in to comment.