From 4c246b80f93c18f752cf96f83f61cbef637c7d48 Mon Sep 17 00:00:00 2001 From: Hansie Odendaal <39146854+hansieodendaal@users.noreply.github.com> Date: Mon, 9 Sep 2024 10:46:58 +0200 Subject: [PATCH] feat: reduce universe spam logs (#6540) Description --- Reduce universe spam logs Motivation and Context --- To much spam logs How Has This Been Tested? --- Unit tests What process can a PR reviewer use to test or verify this change? --- Code review Breaking Changes --- - [x] None - [ ] Requires data directory on base node to be deleted - [ ] Requires hard fork - [ ] Other - Please specify --- .../minotari_console_wallet/log4rs_sample.yml | 4 ++-- .../comms_interface/inbound_handlers.rs | 2 +- .../src/mempool/service/inbound_handlers.rs | 2 +- base_layer/p2p/src/services/liveness/service.rs | 2 +- .../wallet/src/base_node_service/monitor.rs | 2 +- .../tasks/check_faux_transaction_status.rs | 17 +++++++++-------- comms/core/src/protocol/rpc/server/mod.rs | 4 ++-- comms/dht/src/connectivity/mod.rs | 2 +- 8 files changed, 18 insertions(+), 17 deletions(-) diff --git a/applications/minotari_console_wallet/log4rs_sample.yml b/applications/minotari_console_wallet/log4rs_sample.yml index 34fab5373e..67f6bb5b0e 100644 --- a/applications/minotari_console_wallet/log4rs_sample.yml +++ b/applications/minotari_console_wallet/log4rs_sample.yml @@ -129,7 +129,7 @@ loggers: additive: false # network comms: - level: info + level: debug appenders: - network additive: false @@ -144,7 +144,7 @@ loggers: - network additive: false p2p: - level: info + level: debug appenders: - network # Route log events sent to the "mio" logger to the "other" appender diff --git a/base_layer/core/src/base_node/comms_interface/inbound_handlers.rs b/base_layer/core/src/base_node/comms_interface/inbound_handlers.rs index 0a99674dda..1e50894d95 100644 --- a/base_layer/core/src/base_node/comms_interface/inbound_handlers.rs +++ b/base_layer/core/src/base_node/comms_interface/inbound_handlers.rs @@ -119,7 +119,7 @@ where B: BlockchainBackend + 'static /// Handle inbound node comms requests from remote nodes and local services. #[allow(clippy::too_many_lines)] pub async fn handle_request(&self, request: NodeCommsRequest) -> Result { - debug!(target: LOG_TARGET, "Handling remote request {}", request); + trace!(target: LOG_TARGET, "Handling remote request {}", request); match request { NodeCommsRequest::GetChainMetadata => Ok(NodeCommsResponse::ChainMetadata( self.blockchain_db.get_chain_metadata().await?, diff --git a/base_layer/core/src/mempool/service/inbound_handlers.rs b/base_layer/core/src/mempool/service/inbound_handlers.rs index 674a63454d..0ba70ac6a2 100644 --- a/base_layer/core/src/mempool/service/inbound_handlers.rs +++ b/base_layer/core/src/mempool/service/inbound_handlers.rs @@ -60,7 +60,7 @@ impl MempoolInboundHandlers { /// Handle inbound Mempool service requests from remote nodes and local services. pub async fn handle_request(&mut self, request: MempoolRequest) -> Result { - debug!(target: LOG_TARGET, "Handling remote request: {}", request); + trace!(target: LOG_TARGET, "Handling remote request: {}", request); use MempoolRequest::{GetFeePerGramStats, GetState, GetStats, GetTxStateByExcessSig, SubmitTransaction}; match request { GetStats => Ok(MempoolResponse::Stats(self.mempool.stats().await?)), diff --git a/base_layer/p2p/src/services/liveness/service.rs b/base_layer/p2p/src/services/liveness/service.rs index b3e02e82c6..e7407b4190 100644 --- a/base_layer/p2p/src/services/liveness/service.rs +++ b/base_layer/p2p/src/services/liveness/service.rs @@ -323,7 +323,7 @@ where .collect::>(); if selected_peers.is_empty() { - info!( + debug!( target: LOG_TARGET, "Cannot broadcast pings because there are no broadcast peers available" ) diff --git a/base_layer/wallet/src/base_node_service/monitor.rs b/base_layer/wallet/src/base_node_service/monitor.rs index 0acccd01e7..c7c38c1d87 100644 --- a/base_layer/wallet/src/base_node_service/monitor.rs +++ b/base_layer/wallet/src/base_node_service/monitor.rs @@ -187,7 +187,7 @@ where }) .await; - debug!( + trace!( target: LOG_TARGET, "Base node {} Tip: {} ({}) Latency: {} ms", base_node_id, diff --git a/base_layer/wallet/src/transaction_service/tasks/check_faux_transaction_status.rs b/base_layer/wallet/src/transaction_service/tasks/check_faux_transaction_status.rs index ed5541f62f..93a9178ae9 100644 --- a/base_layer/wallet/src/transaction_service/tasks/check_faux_transaction_status.rs +++ b/base_layer/wallet/src/transaction_service/tasks/check_faux_transaction_status.rs @@ -146,17 +146,18 @@ pub async fn check_detected_transactions let must_be_confirmed = tip_height.saturating_sub(mined_height) >= TransactionServiceConfig::default().num_confirmations_required; let num_confirmations = tip_height.saturating_sub(mined_height); - debug!( - target: LOG_TARGET, + + let log_msg = format!( "Updating faux transaction: TxId({}), mined_height({}), must_be_confirmed({}), num_confirmations({}), \ output_status({}), is_valid({})", - tx.tx_id, - mined_height, - must_be_confirmed, - num_confirmations, - output_status, - is_valid, + tx.tx_id, mined_height, must_be_confirmed, num_confirmations, output_status, is_valid ); + if num_confirmations <= 5 { + debug!(target: LOG_TARGET, "{}", log_msg); + } else { + trace!(target: LOG_TARGET, "{}", log_msg); + } + let result = db.set_transaction_mined_height( tx.tx_id, mined_height, diff --git a/comms/core/src/protocol/rpc/server/mod.rs b/comms/core/src/protocol/rpc/server/mod.rs index aa13fac4cd..37e969638a 100644 --- a/comms/core/src/protocol/rpc/server/mod.rs +++ b/comms/core/src/protocol/rpc/server/mod.rs @@ -589,7 +589,7 @@ where return Err(err); } let elapsed = start.elapsed(); - debug!( + trace!( target: LOG_TARGET, "({}) RPC request completed in {:.0?}{}", self.logging_context_string, @@ -671,7 +671,7 @@ where return Ok(()); } - debug!( + trace!( target: LOG_TARGET, "({}) Request: {}, Method: {}", self.logging_context_string, diff --git a/comms/dht/src/connectivity/mod.rs b/comms/dht/src/connectivity/mod.rs index 0aef98ccef..a10c674974 100644 --- a/comms/dht/src/connectivity/mod.rs +++ b/comms/dht/src/connectivity/mod.rs @@ -374,7 +374,7 @@ impl DhtConnectivity { .await?; if new_neighbours.is_empty() { - info!( + debug!( target: LOG_TARGET, "Unable to refresh neighbouring peer pool because there are insufficient known/online peers", );