-
Notifications
You must be signed in to change notification settings - Fork 965
Log Rewards errors by default and add a feature flag for verbose logging #8598
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
Conversation
45b9141
to
5f03daa
Compare
5f03daa
to
baa2948
Compare
@@ -334,6 +334,9 @@ RewardsServiceImpl::RewardsServiceImpl(Profile* profile) | |||
content::URLDataSource::Add(profile_, | |||
std::make_unique<BraveRewardsSource>(profile_)); | |||
ready_ = std::make_unique<base::OneShotEvent>(); | |||
|
|||
if (base::FeatureList::IsEnabled(features::kVerboseLoggingFeature)) | |||
persist_log_level_ = kDiagnosticLogMaxVerboseLevel; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe worth checking the performance impact on Android?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @deeppandya
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it would have any impact on performance. I can run through the branch and quickly check.
vendor/bat-native-ads/src/bat/ads/internal/account/ad_rewards/ad_rewards.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ads/src/bat/ads/internal/account/ad_rewards/ad_rewards.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ledger/src/bat/ledger/internal/legacy/bat_state.cc
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
baa2948
to
c0b0e2e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chromium_src
changes LGTM
const char kBraveRewardsVerboseLoggingName[] = | ||
"Enable Brave Rewards verbose logging"; | ||
const char kBraveRewardsVerboseLoggingDescription[] = | ||
"Enables detailed logging of Brave Rewards system events to a log file"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this should have a warning that says this might log sensitive information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed - I'll add some preliminary text and attach a screenshot.
@@ -790,7 +790,7 @@ class RewardsServiceImpl : public RewardsService, | |||
bool reset_states_; | |||
bool ledger_for_testing_ = false; | |||
bool resetting_rewards_ = false; | |||
bool should_persist_logs_ = false; | |||
int persist_log_level_ = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0
will only log errors. Ideally, this should be 2
, which will also log WARNINGS
and INFO
. Anything above INFO
is considered verbose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that more logging would be ideal. Unfortunately, logging at 2 will create for us a dilemma: we'll likely have to remove useful information from messages at those levels, which will make those levels less useful for development and detailed debugging. I would prefer that we stay with logging only errors by default in this PR, and consider increasing the default log level as a future change.
vendor/bat-native-ads/src/bat/ads/internal/account/ad_rewards/ad_rewards.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ads/src/bat/ads/internal/account/ad_rewards/ad_rewards.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ledger/src/bat/ledger/internal/legacy/bat_state.cc
Outdated
Show resolved
Hide resolved
c0b0e2e
to
59c06c2
Compare
"Enables detailed logging of Brave Rewards system events to a log file " | ||
"stored on your device. Please note that this file may contain sensitive " | ||
"information. Please only submit it using " | ||
"https://upload-support.brave.com/rewards."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might encourage people to send us these files who otherwise might not, and in general we want to collect as little of these log files if possible.
Could we change it to Note that this file may contain sensitive information. Do not share it unless asked to by Brave staff for debugging purposes.
cc @hollons
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That suggestion looks much better to me! I'm going to go ahead and update the PR while we wait on more feedback.
59c06c2
to
4266e7f
Compare
CI Results:
|
4266e7f
to
6136bed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Verification PASSED on
|
Went through the above cases on |
Resolves brave/brave-browser#15500
BraveRewardsVerboseLogging
which can be used to turn on verbose logging.--rewards=persist-logs=1
command line option is still supported, but deprecated in favor of specifying the feature flag on the command line with--enable-features=BraveRewardsVerboseLogging
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
,npm run lint
,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan:
Error logging
brave://rewards-internals
Possible test steps:
brave://rewards-internals
Verbose logging
brave://flags
brave://rewards-internals
Possible test steps
brave://flags
and enable BraveRewardsVerboseLogging.brave://rewards-internals