Baker: setup daily logs by default
Context
This MR aims to enhance the Baker logging process and enable automatic storage of logs on disk. These changes mirror those made to the node recently (for reference, please see !7603 (merged))
These changes are based on several refactorings that were made earlier, as documented in !8241 (merged).
Volume usage
> du -h .tezos-client/logs/octez-baker-017-PtNairob/*
17M .tezos-client/logs/octez-baker-017-PtNairob/daily-20230503.log
17M .tezos-client/logs/octez-baker-017-PtNairob/daily-20230504.log
17M .tezos-client/logs/octez-baker-017-PtNairob/daily-20230505.log
16M .tezos-client/logs/octez-baker-017-PtNairob/daily-20230506.log
15M .tezos-client/logs/octez-baker-017-PtNairob/daily-20230507.log
12M .tezos-client/logs/octez-baker-017-PtNairob/daily-20230508.log
6.3M .tezos-client/logs/octez-baker-017-PtNairob/daily-20230509.log
Here is my baking daily logs directory after a few days of baking on nairobi using the following command:
TEZOS_EVENTS_CONFIG="file-descriptor-path:.tezos-client/logs/octez-baker-017-PtNairob/daily.log
?create-dirs=true&daily-logs=7§ion-prefix=:info&format=pp"
./octez-baker-PtNairob run with local node nairobi-datadir zrg --liquidity-baking-toggle-vote on
This use case can already be tested in the code base by using an equivalent of the command above. A total of ~200Mo of log data is created for seven days. It was running for a few weeks and it stayed pretty constant.
Current patch
- The first commit makes
Client_main_runimplementation stores their logs by default in<base-dir>/logs/<default_daily_logs_path>. - The second commit sets the default variable
default_daily_logs_pathtooctez-baker-<protocol-name>into the baker implementation of this module.
For instance, octez-baker-PtNairob daily logs are listed at .tezos-client/logs/octez-baker-PtNairob/*.
Manual testing
./src/bin_node/octez-sandboxed-node.sh 1 --connections 0
and start baking
eval `./src/bin_client/octez-init-sandboxed-client.sh 1`
octez-baker-alpha run with local node <node-data-dir> --liquidity-baking-toggle-vote pass
now check
ls <sandbox-client-base-dir>/logs/octez-baker-alpha/
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR
Edited by Rémy El Sibaïe