-
Notifications
You must be signed in to change notification settings - Fork 247
EventSource implementation #328
Comments
@vancem any updates? |
Sorry for the delay. This last week I have been filling in for a lead who is on leave, and there simply are not enough hours in the day. I will take a look at this later today. |
This is a straightforward hookup of ILogger to an EventSource. There are many details of exactly how the transformation gets done that are interesting to vet (which is part of the reason it has been taking me a while to give any feedback). Currently all events end up in one EventSource and there is no filtering control at the component level (only the level (volume) control). It also dumps things as JSON which are probably better done as dynamic events. In short, there are issues to resolve. It is fine as something that unblocks someone in the short term, however as a larger standard, I am more concerned. My main issue is that I would like ILogger data to flow into EventSource automatically, without the need for application developers to explicitly wire up the ILogger to a particular EventSource. There is work on such a thing, and ideally we would use that. I realize that there is this tradeoff between having something vs waiting for something that is potentially better. We can use this as a fallback, but I would like to see if we can build a more automatic alternative first. |
Hi Vance, thank you very much for your review. As always it is greatly appreciated! I share your concerns and would like to add some more input: Should the library target .NET 4.5 or 4.6? Damian Edwards said yesterday (ASP.NET Community Standup) that the ASP.NET Core libraries will most likely target .NET 4.5.1 to support Mono. (However, Visual Studio project templates might target .NET 4.6) As far as I understand, having dynamically defined events and rich payload data requires targeting .NET 4.6. Would you target .NET 4.6 with a library like this or would you want to target 4.5.1 to stay consistent with other ASP.NET Core libraries? Since there isn't any real counterpart to ETW on Linux (afaik), targeting 4.6 might not be an issue anyway, right?! Using multiple EventSources I think it's definitely necessary to have some sort of categorization for loggers. However, I think there is a very big difference between the current ILogger implementation and multiple EventSources. If I understand it correctly, the current ILogger system acts like an opt-out system. Everyone (every middleware, every 3rd party, ...) can create its own ILogger with a separate logger name. As an application developer you automatically get all events from all created ILoggers. By default you can filter on the minimum level. Some outputs (Console) also allow you to filter ILogger names like namespaces. This basically means, if you don't want to see something, you have to disable it. (Or in other words, you can't miss something (like errors) unless you disable it) With multiple EventSources however, it is the opposite. If you configure it in your application you explicitly have to define each EventSource you want to subscribe to. Depending on the amount of libraries you use, it might be a very long list and it also might be very hard to even find out which names exist. This means, if you want to log all errors in an application you easily might miss some. In our previous email discussion you said that in-process EventListeners get a callback whenever an EventSource is created. This means it would be possible for something like the Semantic Logging project to do similar namespace-like filtering ("e.g. I want to log all "Microsoft.*" logs). However, it's harder with out-of-process solutions. I'm afraid that this means we have to specify each EventSource name in solutions like Azure Diagnostics. This seems like an inconvenient way because whenever you need to change the configuration, you have to do a redeployment. There might just be too many interesting EventSources. Lack of tooling support for .NET 4.6 ETW features Semantic Logging seems to be one of the best libraries for EventSource. However it doesn't support some of the new features that were introduced in .NET 4.6. I know that this is a temporary issue and can (and hopefully will) be fixed, I just want to point it out again. Disclaimer: my main scenario Next steps |
@vancem Do you know if there is a way to use the EventSource to log dynamic events which are not rooted by a compile-time type? I guess it would be possible to ref-emit a Type at runtime to reach the new Write feature. |
I'm closing this since there is a newer PR for EventSource in #424 |
The PR is out, but we use issues to create release notes 😄 |
But thanks for pinging on this bug, otherwise we'd have forgotten! |
@karolz-ms are you tracking this bug (and #424) for RTM still? Please note that we have little time left before the ask mode. :) |
@muratg I am trying to get 424 ready for RTM and I am aware of the scheduling. But as they say it ain't ready till it is ready and there are still some issues... |
@karolz-ms Agreed! :) Putting in 1.0.1 for now. If it's ready in a reasonable time, we'll bring it back to 1.0.0. |
@karolz-ms, @BrennanConroy was talking about some issues with .NET 4.5.*. Could you guys sync-up? |
We did :) working on next steps |
Should this bug be assigned to someone? |
Yeah, me or somone of your choosing |
I choose you? :pokemon: |
Looks like @muratg chose me :P |
I never said I was good at :pokemon: 😄 |
Hi, I created a logger implementation which forwards messages to a System.Diagnostics.Tracing.EventSource and was wondering if this would be interesting for you since EventSource is one of the recommended ways to log in the .NET framework.
https://github.com/cwe1ss/Logging/tree/EventSource/src/Microsoft.Extensions.Logging.EventSource
it has the following features:
If this is interesting for you, I'd be happy to do necessary changes and create a pull request.
@vancem - feedback would be appreciated!
best regards, christian
The text was updated successfully, but these errors were encountered: