From 8eaee7857da1362e374ad038bb26b1eb5ad50f9a Mon Sep 17 00:00:00 2001 From: stringhandler Date: Tue, 3 Sep 2024 19:07:30 +0200 Subject: [PATCH] feat: add grpc specific log file --- applications/minotari_node/log4rs_sample.yml | 23 ++++++++++++++++++- .../src/grpc/base_node_grpc_server.rs | 2 ++ src/nodeenv | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) create mode 160000 src/nodeenv diff --git a/applications/minotari_node/log4rs_sample.yml b/applications/minotari_node/log4rs_sample.yml index bb9b862b01..0fb98ea70b 100644 --- a/applications/minotari_node/log4rs_sample.yml +++ b/applications/minotari_node/log4rs_sample.yml @@ -53,7 +53,6 @@ appenders: encoder: pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] [Thread:{I}] {l:5} {m} // {f}:{L}{n}" - # An appender named "base_layer" that writes to a file with a custom pattern encoder base_layer: kind: rolling_file @@ -71,6 +70,23 @@ appenders: encoder: pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} [{t}] [{X(node-public-key)},{X(node-id)}] {l:5} {m} // {f}:{L}{n}" + # An appender named "base_layer" that writes to a file with a custom pattern encoder + grpc: + kind: rolling_file + path: "{{log_dir}}/log/base_node/grpc.log" + policy: + kind: compound + trigger: + kind: size + limit: 10mb + roller: + kind: fixed_window + base: 1 + count: 5 + pattern: "{{log_dir}}/log/base_node/grpc.{}.log" + encoder: + pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {l:5} {m} // {f}:{L}{n}" + # An appender named "other" that writes to a file with a custom pattern encoder other: kind: rolling_file @@ -104,6 +120,11 @@ loggers: - other additive: false + minotari::base_node::grpc: + level: debug + appenders: + - grpc + # Route log events sent to the "core" logger to the "base_layer" appender c: level: debug diff --git a/applications/minotari_node/src/grpc/base_node_grpc_server.rs b/applications/minotari_node/src/grpc/base_node_grpc_server.rs index 7133112dca..96fae8d189 100644 --- a/applications/minotari_node/src/grpc/base_node_grpc_server.rs +++ b/applications/minotari_node/src/grpc/base_node_grpc_server.rs @@ -269,6 +269,8 @@ impl tari_rpc::base_node_server::BaseNode for BaseNodeGrpcServer { let page_iter = NonOverlappingIntegerPairIter::new(start_height, end_height.saturating_add(1), GET_DIFFICULTY_PAGE_SIZE) .map_err(|e| obscure_error_if_true(report_error_flag, Status::invalid_argument(e)))?; + + debug!(target: LOG_TARGET, "Starting GetNetworkDifficulty request from {} to {}", start_height, end_height); task::spawn(async move { for (start, end) in page_iter { // headers are returned by height diff --git a/src/nodeenv b/src/nodeenv new file mode 160000 index 0000000000..a6585e9a63 --- /dev/null +++ b/src/nodeenv @@ -0,0 +1 @@ +Subproject commit a6585e9a63e1601c4a37f3a1bb8fd0722dd6b51c