NethermindEth / juno

Starknet client implementation.
https://juno.nethermind.io
Apache License 2.0
392 stars 171 forks source link

Dynamic logging lvl #1181

Open Exca-DK opened 1 year ago

Exca-DK commented 1 year ago

Issue

Currently, logging is only set at the bootstrap with the defined log level. It would be beneficial to have the capability to dynamically change that through RPC. Furthermore, for greater extendability, it would be valuable to make it configurable per module.

Rationale

Why should this feature exist? Enhanced debugging and observability. Often, managing nodes requires specific logging for a limited duration. Maintaining a low level for the entire node lifetime is unnecessary. Additionally, some loggers in the codebase have hardcoded lvl such as the one in DB.

What are the use cases? The feature would be particularly useful for debugging modules eg. enabling more verbose logs for the p2p module while keeping the rest of the loggers unchanged or temporarily lowering the global logging level.

Implementation

Do you have ideas regarding the implementation of this feature? yes Are you willing to implement this feature? yes

kirugan commented 1 year ago

But in case something goes wrong, one can always restart a node with a different log level.

Exca-DK commented 1 year ago

Sometimes you don't want to restart the whole node. I'll try to give an even more concrete examples: A: Node that runs only p2p sees a spike in network metrics or high cpu usage etc. When you restart the node, you will get different peers so different potential result. B: Sees low lvl of peers. Would be nice to turn more verbose logging just for p2p module to not clutter logs with non-relevant logs.