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

fix_: set log level to debug for mobile release build doesn't generate log file #6202

Merged
merged 1 commit into from
Dec 13, 2024

Conversation

qfrank
Copy link
Contributor

@qfrank qfrank commented Dec 12, 2024

Currently, mobile release build disabled log by default via .env.release, so there's no log files generated(it was generated before, that's because when log is disabled with .env, frontend will invoke initLogging with logLevel ERROR which should be an old bug). However, when user change log level from disabled to debug, then re-login, still no log files(e.g. geth.log) as log is still disabled in log_config, this PR fixed this issue,
relate mobile issue

image

@qfrank qfrank self-assigned this Dec 12, 2024
@qfrank qfrank requested a review from osmaczko December 12, 2024 01:50
@status-im-auto
Copy link
Member

status-im-auto commented Dec 12, 2024

Jenkins Builds

Click to see older builds (16)
Commit #️⃣ Finished (UTC) Duration Platform Result
✖️ 5b1df7a #1 2024-12-12 01:55:08 ~4 min tests 📄log
✔️ 5b1df7a #1 2024-12-12 01:55:25 ~4 min macos 📦zip
✔️ 5b1df7a #1 2024-12-12 01:55:30 ~4 min ios 📦zip
✔️ 5b1df7a #1 2024-12-12 01:56:37 ~5 min linux 📦zip
✔️ 5b1df7a #1 2024-12-12 01:56:45 ~5 min android 📦aar
✔️ 5b1df7a #1 2024-12-12 01:56:59 ~5 min windows 📦zip
✖️ 5b1df7a #1 2024-12-12 01:57:40 ~6 min tests-rpc 📄log
✔️ 5b1df7a #1 2024-12-12 02:00:25 ~9 min macos 📦zip
✔️ 1eb6a2b #2 2024-12-12 02:40:09 ~4 min windows 📦zip
✔️ 1eb6a2b #2 2024-12-12 02:40:18 ~4 min macos 📦zip
✔️ 1eb6a2b #2 2024-12-12 02:40:31 ~4 min ios 📦zip
✔️ 1eb6a2b #2 2024-12-12 02:41:11 ~5 min linux 📦zip
✔️ 1eb6a2b #2 2024-12-12 02:41:31 ~5 min android 📦aar
✔️ 1eb6a2b #2 2024-12-12 02:42:41 ~6 min tests-rpc 📄log
✔️ 1eb6a2b #2 2024-12-12 02:44:09 ~8 min macos 📦zip
✔️ 1eb6a2b #2 2024-12-12 03:07:12 ~31 min tests 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 31d9c6f #3 2024-12-12 09:12:59 ~4 min macos 📦zip
✔️ 31d9c6f #3 2024-12-12 09:13:02 ~4 min ios 📦zip
✔️ 31d9c6f #3 2024-12-12 09:13:46 ~5 min windows 📦zip
✔️ 31d9c6f #3 2024-12-12 09:14:06 ~5 min linux 📦zip
✔️ 31d9c6f #3 2024-12-12 09:14:15 ~5 min android 📦aar
✔️ 31d9c6f #3 2024-12-12 09:15:12 ~6 min tests-rpc 📄log
✔️ 31d9c6f #3 2024-12-12 09:18:25 ~9 min macos 📦zip
✔️ 31d9c6f #3 2024-12-12 09:38:28 ~29 min tests 📄log
✔️ 31d9c6f #4 2024-12-12 19:12:13 ~4 min macos 📦zip
✔️ 31d9c6f #4 2024-12-12 19:12:15 ~4 min windows 📦zip
✔️ 31d9c6f #4 2024-12-12 19:12:19 ~4 min ios 📦zip
✔️ 31d9c6f #4 2024-12-12 19:13:12 ~5 min linux 📦zip
✔️ 31d9c6f #4 2024-12-12 19:13:36 ~5 min android 📦aar
✔️ 31d9c6f #4 2024-12-12 19:13:50 ~6 min tests-rpc 📄log
✔️ 31d9c6f #4 2024-12-12 19:17:45 ~9 min macos 📦zip
✔️ 31d9c6f #4 2024-12-12 19:37:29 ~29 min tests 📄log
✔️ 5dfefcb #5 2024-12-12 19:16:39 ~4 min windows 📦zip
✔️ 5dfefcb #5 2024-12-12 19:16:45 ~4 min macos 📦zip
✔️ 5dfefcb #5 2024-12-12 19:17:09 ~4 min ios 📦zip
✔️ 5dfefcb #5 2024-12-12 19:18:45 ~5 min linux 📦zip
✔️ 5dfefcb #5 2024-12-12 19:19:19 ~5 min android 📦aar
✔️ 5dfefcb #5 2024-12-12 19:20:15 ~6 min tests-rpc 📄log
✔️ 5dfefcb #5 2024-12-12 19:26:15 ~8 min macos 📦zip
✔️ 5dfefcb #5 2024-12-12 20:07:34 ~29 min tests 📄log

Copy link
Contributor

@ilmotta ilmotta left a comment

Choose a reason for hiding this comment

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

@qfrank bug is fixed in my tests with the mobile client 🙏🏼 Thank you

Copy link

codecov bot commented Dec 12, 2024

Codecov Report

Attention: Patch coverage is 65.00000% with 7 lines in your changes missing coverage. Please review.

Please upload report for BASE (release/7.1.x@eaf937a). Learn more about missing BASE report.

Files with missing lines Patch % Lines
protocol/messenger_sync_settings.go 58.82% 5 Missing and 2 partials ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##             release/7.1.x    #6202   +/-   ##
================================================
  Coverage                 ?   60.95%           
================================================
  Files                    ?      832           
  Lines                    ?   109876           
  Branches                 ?        0           
================================================
  Hits                     ?    66972           
  Misses                   ?    35058           
  Partials                 ?     7846           
Flag Coverage Δ
functional 13.90% <5.00%> (?)
unit 60.07% <65.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
nodecfg/node_config.go 66.00% <100.00%> (ø)
protocol/messenger_sync_settings.go 64.00% <58.82%> (ø)

@qfrank qfrank changed the title fix_: can't set log level for release build fix_: set log level to debug for mobile release build doesn't generate log file Dec 12, 2024
@ilmotta ilmotta requested a review from alwx December 12, 2024 17:41
@ilmotta ilmotta changed the base branch from develop to release/7.1.x December 12, 2024 19:07
@igor-sirotin
Copy link
Collaborator

igor-sirotin commented Dec 12, 2024

I'm a bit confused with this fix.
And the Debug log switch works just fine in Desktop. Let me check the code there.

Copy link
Collaborator

@igor-sirotin igor-sirotin left a comment

Choose a reason for hiding this comment

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

I checked the desktop code and we're using this endpoint when toggling Debug.

status-go/services/ext/api.go

Lines 1807 to 1809 in 50933aa

func (api *PublicAPI) SetLogLevel(request *requests.SetLogLevel) error {
return api.service.messenger.SetLogLevel(request)
}

Works just fine, I can see the debug logs after restart.

I also understand the confusion, I am also surprised that log_level is stored both 2 tables: settings and node_config. We definitely need to clean this up.


@qfrank @ilmotta Knowing the release urgency, I am not against this fix if it helps.

But it seems that status-mobile should use a different endpoint (not because it's the right one, but because it's the working one). I suggest that to be done at least for the develop cherry-pick.

Comment on lines +200 to +208
func (m *Messenger) setLogLevel(level string, logger *zap.Logger) {
if level == "" {
return
}
err := nodecfg.SetLogLevel(m.database, level)
if err != nil {
logger.Error("nodecfg.SetLogLevel", zap.Error(err))
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is such a method already:

func (m *Messenger) SetLogLevel(request *requests.SetLogLevel) error {
if err := request.Validate(); err != nil {
return err
}
return nodecfg.SetLogLevel(m.database, request.LogLevel)
}

Copy link
Contributor Author

@qfrank qfrank Dec 12, 2024

Choose a reason for hiding this comment

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

I agree frontend should use different endpoint(that was also my consideration when trying to fix this) and we definitely should do it like this later, but based on the release urgency, I prefer fix it with current way.

setLogLevel won't enable/disable log. And it require extra effort on the frontend side. @igor-sirotin

Copy link
Collaborator

@igor-sirotin igor-sirotin Dec 12, 2024

Choose a reason for hiding this comment

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

@qfrank but.. why did log ended up being disabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@qfrank but.. why did log ended up being disabled?

because mobile disabled log with release build by default @igor-sirotin

Copy link
Contributor Author

@qfrank qfrank Dec 13, 2024

Choose a reason for hiding this comment

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

also pls see the discussions why we didn't enable it by default ATM @igor-sirotin

@igor-sirotin igor-sirotin self-requested a review December 13, 2024 12:20
Copy link
Collaborator

@igor-sirotin igor-sirotin left a comment

Choose a reason for hiding this comment

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

Alright, let's merge it for the release.
But for develop fix we'll need:

  • remove code duplication
  • probably use a different endpoint from status-mobile

And in general, we need to review the way we store settings and all this mess with NodeConfig. But it's a separate big story.

@igor-sirotin igor-sirotin merged commit 5d9072c into release/7.1.x Dec 13, 2024
15 checks passed
@igor-sirotin igor-sirotin deleted the fix/no_log2 branch December 13, 2024 12:21
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