-
Notifications
You must be signed in to change notification settings - Fork 765
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
Proposal to create public Logging APIs and log writer for easier Self Diagnostics experience #1258
Comments
Can you elaborate more on # 3 of your plan... It sounds like the order of operations is this:
I think it would be more efficient to log straight to file when your LogError method is called. (skipping 3). I think emitting to ETW is still valid. I think subscribing to ETW is still valid. Some users may want to configure additional event sources to subscribe to. |
I have a big problem with the proposal to create a new logging implementation. This library already takes a bleeding edge dependency on |
Myunderstanding is this: The reason why I prefer to use EventSource, as opposed to Ms.Ext.Logging is because of this: @alanwest and I discussed the option of EventSource vs ILogger for Otel itself. Other Otel libraries (eg: NewRelic Otel exporter) is using ILogger. Happy to have more discussions on this. We can seek expert suggestions from .NET diagnostic team as well. |
In Azure ApplicationInsight, we did log to both Ilogger and eventsource here: We need to evaluate this further. |
It seems like you are arguing that the primary reason for not wanting to use Ms.Ext.Logging is because it can't capture issues during bootstrap. Well, 1) this library isn't typically used that early in the application and 2) you can capture bootstrapping issues using Ms.Ext.Logging just fine since it's just a logging abstraction and you could hook it up as early as you want in the app. Look at the Serilog example from this page: https://github.com/serilog/serilog-aspnetcore For me though, my main argument is that EventSource / PerfView is not easy to use. I want to be able to just say AddOpenTelemetryTracing and immediately see issues. I could also turn my logging level up and be able to see detailed information about what is happening in the OTel client. |
-- not exactly. That's just one reason. There are many I think, but I will get the official recommendation from .NET Diagnostics team. |
It supports 4.6.1 in latest release: https://www.nuget.org/packages/Microsoft.Extensions.Logging.Abstractions/5.0.0-rc.1.20451.14 |
This is exactly what me and @alanwest concluded. |
mm.. We need net452 as well, as we support net452, and net452 is officially Microsoft supported. |
Any particular reason you decided to go back that far? To me it seems highly unlikely that someone would use this library in an old application that isn't even upgraded to the latest version of full framework which has full backwards compatibility with all previous versions. This library is still brand new and not even out of alpha yet. I can't see someone who won't upgrade their .NET framework version adding new code to their apps to integrate Open Telemetry. |
.NET452 is an officially supported version by Microsoft. When Microsoft drops support for it, we can drop support for it as well. But until then we have to support this. (There were discussions in early SIG meeting on this, and I believe the consensus was to support all officially supported .NET versions) |
Btw - I am not opposed to using ILogger :) As long as it can meet all the requirements, happy to use it. |
@shirhatti What are your thoughts on using EventSource vs ILogger as the mechanism to log from the OpenTelemetry SDK itself? |
I don't understand why this is even a statement, considering one of the main adapters for Why would you ever want to take a static dependency with I'll be honest in saying it surprised me to see all those hardcoded This proposal itself feels like we are trying to reinvent a wheel: the logging mechanism already exists and is already stable, just use it. I mentioned this in a discussion and I'll mention it here again: as a consumer of the library, I personally think the current logging/diagnostics solution is abysmal. It needs excessive setup and uses weird nonstandard patterns like "add this weirdly named json file and a txt log will be created per execution". I've shown that mechanism to a few developers on my team and the immediate reaction I get is a frown: as expected. That entire mechanism should literally not exist IMHO, and even if it did, it should be based on appsettings/system.configuration flags which at least are the expected configuration points for a thing such as that. |
#1258 (comment) explained why - when this was originally designed, ILogger wasn't even available for the runtime versions that OpenTelemetry .NET was targeting... |
Current Problems
Every project needs to create its own EventSource implementation, most of which is repeated boilerplate code to achieve the same purpose. Currently there are 14 EventSource implementations for emitting errors, yet it's not straight-forward to capture and log these EventSource events in case of need for troubleshooting.
Proposal
To solve these problems, I'm trying to provide a cross-platform logging API and self diagnostics module, which provides two key features:
Logging APIs
The Logging APIs are some generic methods like LogVerbose or LogError, located in a public namespace/class for all OpenTelemetry to call for self diagnostics or troubleshooting. Once it's done, the use of other EventSources can be migrated to this. These Logging APIs still use EventSource as the underlying mechanism.
A sample use of the API I want to make is like this:
(The exact namespace is to be figured out later.)
When the Self Diagnostics Module is enabled, the log message including timestamp, error level, class name, error message (and optionally exception stack) would be written to a local file as such:
Self Diagnostics Module
Implementation Plan
The text was updated successfully, but these errors were encountered: