You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From an email thread with Krzysztof Cwalina and Pavel Krymets we were discussing that EventSource has rough edges when you try to use it for textual logging:
This is pretty much all I would have, built-in sinks, built-in simple text source, support for Azure functions (whether it needs multitenancy or not).
One other issue I’ve seen is a performance of in-process EventSource listener, there are a lot of allocations per event.
For in-process listeners, I'd like to be able to pass Exception instance and strings of arbitrary length around. The problem is that it doesn't work with ETW.
The context of this issue is that EventSource events were getting serialized as a string so they could be put into a text log. That requires the runtime to convert the exception into a string of some form. If you want to pass around exception object instances and get references back as-is from an in-proc sink that sounds like a scenario DiagnosticsSource was aiming to handle. If you also didn't want to use DiagnosticsSource for whatever reason but you did want the sink to receive an instance of arbitrary Exceptions then we should probably revisit the overall scenario because that wasn't the trajectory I thought we were on.
Let me clarify where I'm coming from. Even if we add support for console text logging to EventSource we would still need a way to forward events from EventSource to ILogger for scenarios where the library is used in ASP.NET Core environment.
So you are right that this is not a request for purely "text logging" improvement, more something we would need to have if EventSource would be the only logging mechanism used by the library.
I got another one to add about object lifetime, thread safety and testability. I've spent the last day fighting with EventSource and EventListener trying to write a set of unit tests that run in parallel. Even when creating objects that look like they don't mutate global state, it seems like they still do. I think it's a massive design flaw of the current object model to do things implicitly like that.
Activity
pakrym commentedon May 21, 2019
Exceptionobjects directlypakrym commentedon May 23, 2019
noahfalk commentedon May 23, 2019
What scale of payload do you need to log?
noahfalk commentedon May 23, 2019
For exceptions do you have any particular expectations for what the serialized format is?
pakrym commentedon May 24, 2019
For in-process listeners, I'd like to be able to pass Exception instance and strings of arbitrary length around. The problem is that it doesn't work with ETW.
noahfalk commentedon May 24, 2019
The context of this issue is that EventSource events were getting serialized as a string so they could be put into a text log. That requires the runtime to convert the exception into a string of some form. If you want to pass around exception object instances and get references back as-is from an in-proc sink that sounds like a scenario DiagnosticsSource was aiming to handle. If you also didn't want to use DiagnosticsSource for whatever reason but you did want the sink to receive an instance of arbitrary Exceptions then we should probably revisit the overall scenario because that wasn't the trajectory I thought we were on.
pakrym commentedon May 24, 2019
Let me clarify where I'm coming from. Even if we add support for console text logging to EventSource we would still need a way to forward events from EventSource to ILogger for scenarios where the library is used in ASP.NET Core environment.
So you are right that this is not a request for purely "text logging" improvement, more something we would need to have if EventSource would be the only logging mechanism used by the library.
noahfalk commentedon May 24, 2019
Gotcha - I just opened dotnet/coreclr#24773 which I think is a little more targeted at your aim.
davidfowl commentedon Jun 5, 2019
I got another one to add about object lifetime, thread safety and testability. I've spent the last day fighting with EventSource and EventListener trying to write a set of unit tests that run in parallel. Even when creating objects that look like they don't mutate global state, it seems like they still do. I think it's a massive design flaw of the current object model to do things implicitly like that.