Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: log to base dir #5197

Merged
merged 7 commits into from
Feb 28, 2023

Conversation

brianp
Copy link
Contributor

@brianp brianp commented Feb 21, 2023

Description

  • Change the logging initialization to account for the -b option on application startup, and dynamically replace the new {{log_dir}} placeholder value inside the log4rs files.
  • Update logging directory naming for consistency from base-node to base_node
  • Fix the log4rs config for the tari miner so it will log to stdout as well as the created log file
  • Update tari miner log target for consistency

Motivation and Context

log4rs considers the cli working directory the root. From there it appends the path from the log4rs yaml file as a relative path (unless it's an absolute path). The problem with this is that it completely disregards the standard Tari cli option -b for assigning a base directory. This can result in the configuration in the expected assigned location, and the logging ending up in whatever working directory you happened to be in at the time. This has resulted in me finding lots of orphaned logging directories and files spread over my local system.

How Has This Been Tested?

Tested locally by using the -b option to a location different than the current working directory and ensuring all config and logs end up in the directory provided. Whereas before the log dir still would have been created in the working directory.

BREAKING CHANGE: This PR changes the logging configuration which is only generated on the first run. Users may wish to remove log config files:

  • base_dir/config/base_node/log4rs.yml
  • base_dir/config/miner/log4rs.yml
  • base_dir/config/wallet/log4rs.yml

Instead of feeding log4rs a file, load the yaml and feed log4rs a
string. The purpose of this is to prepare the file contents for
manipulation before handing them over to log4rs.
This is because we will need to know the path to replace in the
contents.
Use a simple and naive placeholder swap out.
All other base_node directories in the config directory are consistent
with underscores except the log dir. Until now.
I think the log was meant to print to stdout as well as the miner
appender. It was done by duplicated a section of yaml, but that infact
overrides one for the other. So we only had stdout, and never to the log
file.

Remove the duplicated block, and have all output go to stdout and the
miner logfile.
I chose to remove tari_miner in favour of tari::miner to match the
standard of the base node. The wallet is still an outlier but none of
them use the tari_APP scheme so this was an outlier.
@brianp brianp changed the title feature: log to base dir feat: log to base dir Feb 21, 2023
@brianp brianp marked this pull request as ready for review February 21, 2023 16:28
@delta1
Copy link
Contributor

delta1 commented Feb 21, 2023

#4538

Copy link
Collaborator

@SWvheerden SWvheerden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@stringhandler stringhandler merged commit 5147b5c into tari-project:development Feb 28, 2023
stringhandler pushed a commit that referenced this pull request Mar 8, 2023
### ⚠ BREAKING CHANGES

* **peer_db:** more accurate peer stats per address (5142)
* use consensus hashing API for validator node MMR (5207)
* **consensus:** add balanced binary merkle tree (5189)

### Features

* add favourite flag to contact ([5217](#5217)) ([0371b60](0371b60))
* add indexer config ([5210](#5210)) ([cf95601](cf95601))
* add merge proof for balanced binary merkle tree ([5193](#5193)) ([8962909](8962909))
* **consensus:** add balanced binary merkle tree ([5189](#5189)) ([8d34e8a](8d34e8a))
* log to base dir ([#5197](#5197)) ([5147b5c](5147b5c))
* **peer_db:** more accurate peer stats per address ([5142](#5142)) ([fdad1c6](fdad1c6))


### Bug Fixes

* add grpc commitment signature proto type ([5200](#5200)) ([d523f1e](d523f1e))
* peer seeds for esme/igor ([5202](#5202)) ([1bc226c](1bc226c))
* remove panics from merged BBMT verification ([5221](#5221)) ([a4c5fce](a4c5fce))
* source coverage ci failure ([5209](#5209)) ([80294a1](80294a1))
* use consensus hashing API for validator node MMR ([5207](#5207)) ([de28115](de28115))
* wallet reuse existing tor address ([5092](#5092)) ([576f44e](576f44e))
* **wallet:** avoids empty addresses in node identity ([5224](#5224)) ([1a66312](1a66312))
@brianp brianp deleted the feature-log-to-basedir branch October 2, 2023 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants