Skip to content

Commit

Permalink
feat: add grpc specific log file
Browse files Browse the repository at this point in the history
  • Loading branch information
stringhandler committed Sep 3, 2024
1 parent c1b5c02 commit 8eaee78
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
23 changes: 22 additions & 1 deletion applications/minotari_node/log4rs_sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions applications/minotari_node/src/grpc/base_node_grpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/nodeenv
Submodule nodeenv added at a6585e

0 comments on commit 8eaee78

Please sign in to comment.