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

Reduce default log level from CONFIG to INFO #817

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

ok300
Copy link
Collaborator

@ok300 ok300 commented Mar 13, 2024

The CONFIG level resulted in logging the sending and receiving of gRPC data frames, which is spamming the logs:

[BreezSdk] {CONFIG} (2024-03-13T09:51:00.634293Z) : send frame=Data { stream_id: StreamId(1) }
[BreezSdk] {CONFIG} (2024-03-13T09:51:00.735160Z) : send frame=Data { stream_id: StreamId(1), flags: (0x1: END_STREAM) }
[BreezSdk] {CONFIG} (2024-03-13T09:51:01.103566Z) : received frame=Settings { flags: (0x1: ACK) }
[BreezSdk] {CONFIG} (2024-03-13T09:51:01.117228Z) : received settings ACK; applying Settings { flags: (0x0), enable_push: 0, initial_window_size: 2097152, max_frame_size: 16384 }
[BreezSdk] {CONFIG} (2024-03-13T09:51:01.157191Z) : received frame=WindowUpdate { stream_id: StreamId(0), size_increment: 73 }
[BreezSdk] {CONFIG} (2024-03-13T09:51:01.222232Z) : received frame=Headers { stream_id: StreamId(1), flags: (0x4: END_HEADERS) }
[BreezSdk] {CONFIG} (2024-03-13T09:51:01.271599Z) : received frame=Data { stream_id: StreamId(1) }
[BreezSdk] {CONFIG} (2024-03-13T09:51:01.346240Z) : received frame=Headers { stream_id: StreamId(1), flags: (0x5: END_HEADERS  | END_STREAM) }

These logs appear to be emitted by the lower-level networking calls in flutter. I found no way to specifically target this networking module with a higher log level. @erdemyerebasmaz @ademar111190 if you see a better solution, please let me know.

Copy link
Member

@roeierez roeierez left a comment

Choose a reason for hiding this comment

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

LGTM

@erdemyerebasmaz
Copy link
Collaborator

They do come from SDK afaik and it's better to lower them to trace/verbose level on there.

@ok300
Copy link
Collaborator Author

ok300 commented Mar 13, 2024

The CLI sdk.log doesn't include such statements. So it doesn't look like it's coming from the SDK.

@ok300
Copy link
Collaborator Author

ok300 commented Mar 13, 2024

I could only get such logs in the CLI

[2024-03-13 13:34:28.392 DEBUG h2::codec::framed_write:213] send frame=Data { stream_id: StreamId(1) }

when I ran the SDK entirely on trace logging.

But the default SDK level is debug, with many verbose subcomponents set to warn.

So maybe flutter overrides the global logger level?

@erdemyerebasmaz
Copy link
Collaborator

erdemyerebasmaz commented Mar 13, 2024

I could only get such logs in the CLI

[2024-03-13 13:34:28.392 DEBUG h2::codec::framed_write:213] send frame=Data { stream_id: StreamId(1) }

when I ran the SDK entirely on trace logging.

But the default SDK level is debug, with many verbose subcomponents set to warn.

So maybe flutter overrides the global logger level?

It's not flutter that overrides the global logger level. Binding has it's own logger implementation. It's level is set to TRACE by default and filtering out is done on the app side. That's why we see these identifiers on the logs [BreezSdk] {CONFIG}, these are debug level statements coming from the SDK log stream.

This appears to have performance implications and we could add SDK logger level setting to sdk.Config.

That's a bit beside the point though, the point is: the level on origin of these log statements should be downgraded to TRACE level. Which I believe is here on the SDK.

@ok300
Copy link
Collaborator Author

ok300 commented Mar 13, 2024

The SDK log filters only affect what lands in sdk.log. This output does not contain any send frame=Data logs, meaning the SDK filters them out.

these are debug level statements coming from the SDK log stream

AFAIK the SDK log filter doesn't affect the log stream. This means bindings that register for the log stream would get all log events. If that's true, any log fine-tuning for apps using the bindings can only be done in the app.

@roeierez am I missing something? Should I look into filtering the log stream on SDK side?

Copy link
Collaborator

@erdemyerebasmaz erdemyerebasmaz left a comment

Choose a reason for hiding this comment

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

@ok300 Let's merge this as the underlying problem is much more complicated to fix on the SDK involving env_logger crate, parse_filters config & track_logs logic.

@erdemyerebasmaz erdemyerebasmaz merged commit 073a9a2 into main Mar 13, 2024
1 check passed
@ok300 ok300 deleted the ok300-reduce-verbose-logging branch March 15, 2024 10:15
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.

3 participants