-
Notifications
You must be signed in to change notification settings - Fork 98
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
Configurable log level - native code and loader #2288
Configurable log level - native code and loader #2288
Conversation
{ | ||
m_fileout = spdlog::rotating_logger_mt("Logger", GetLogPath(file_name_suffix), 1048576 * 5, 10); |
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 will make size configurable with OTEL_DOTNET_AUTO_LOG_FILE_SIZE
in a separate PR.
// By writing into the stderr was changing the behavior in a CI scenario. | ||
// There's not a good way to report errors when trying to create the log file. | ||
// But we never should be changing the normal behavior of an app. | ||
// std::cerr << "LoggerImpl Handler: Error creating native log file." << std::endl; | ||
m_fileout = spdlog::null_logger_mt("LoggerImpl"); |
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.
Filtering out in sink yields simpler implementation (compared to tracking if logLevel
is enabled in LoggerImpl
before forwarding to sinks), but results in overhead of LogToString
conversion which might not be needed. Let me know if I should address that in a separate PR.
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'm in favor of adding it in a separate PR: it is typical for log systems to avoid extra work depending on the log level. That's why the log levels are usually treated as comparable integers.
src/OpenTelemetry.AutoInstrumentation.Loader/Loader.NetFramework.cs
Outdated
Show resolved
Hide resolved
src/OpenTelemetry.AutoInstrumentation.Loader/OpenTelemetry.AutoInstrumentation.Loader.csproj
Show resolved
Hide resolved
76621d9
to
8a2f5f3
Compare
Why
Towards #2183
Fixes #372
What
Handle configured
OTEL_LOG_LEVEL
in native code and loader.OTEL_LOG_LEVEL
value, or usenull_sink
ifnone
is configured- Removed benchmarks of removed(update: split into DropLoaderLogger
LoaderLogger
benchmarks #2289 )Tests
Checklist
CHANGELOG.md
is updated.- [ ] New features are covered by tests.