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

[Logging] Improve logging in DAB: Use StructuredLoggingInterpolatedStringHandler #2442

Open
sezal98 opened this issue Oct 28, 2024 · 0 comments

Comments

@sezal98
Copy link
Contributor

sezal98 commented Oct 28, 2024

Traditional structured logging is a quite expensive operation as it involves parsing the template string at runtime, and its memory is allocated for the arguments array even if the specified log level is disabled. Also, it is easy to forget some arguments or use a wrong argument order.

Please look at the following links

Image

Looking at the above screenshot, we observe that by using traditional Structured Logging we get 94.43 ns and by using the custom string interpolation techniques we get almost 14ns.
Also, memory usage is nil when the log level is disabled by using the custom handler.
We should explore this or any other efficient log method further.

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

No branches or pull requests

1 participant