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

Issue with EventSource integration #44

Closed
antonGritsenko opened this issue Feb 22, 2018 · 21 comments
Closed

Issue with EventSource integration #44

antonGritsenko opened this issue Feb 22, 2018 · 21 comments

Comments

@antonGritsenko
Copy link

Hello all

We have Service Fabric project builds using ASP.NET Core template with .NET Framework 4.6. Inside of the project we using ILogger from ASP.NET Core and EventSource build-in logger. With regular project (out of Service Fabric) it works fine, but inside Service Fabric it kind of strange behavior:

  1. Events are actually generated, I can collect them to etl flle with any tools
  2. During debugging in Visual Studio, I see message "The parameters to the Event method do not match the parameters to the WriteEvent method. This may cause the event to be displayed incorrectly." in the Debug output on EACH and every message from EventSource logger
  3. No messages are in Diagnostic Events inside Visual Studio (filter is configured to capture "Microsoft-Extensions-Logging" events). One more, on each message from EventSource logger logging in Diagnostic Events window stoped for couple seconds and then started again.

(2) looks like related to this, but in full framework:
dotnet/coreclr#8942
https://github.com/dotnet/corefx/issues/15269
microsoft/ApplicationInsights-SDK-Labs#97

But I have no explanation for (3). Any inputs?

@karolz-ms
Copy link

Anton, what version of the SF SDK are our using?

Regarding (2) we had a similar issue with one of the SF EventSources as well, but I believe that was also fixed a couple of releases ago. When you are saying the message is related to "EventSource logger", which EventSource does it refer to, exactly?

Regarding (3) can you describe how you enabled Microsoft-Extensions-Logging EventSource? In particular, did you call AddEventSourceLogger() to enable that source in your app startup code?

A standalone repro app that demonstrates the problem and that we could download from GitHub and play with would be very helpful

@antonGritsenko
Copy link
Author

Answers on 2 and 3 is same, this is OOB EventSource provider from ASP.NET Core https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?tabs=aspnetcore2x#eventsource

@antonGritsenko
Copy link
Author

antonGritsenko commented Feb 26, 2018

Sorry for delay, here is info about Service Fabric API version: 2.8.219
And here is sample project to repro: https://github.com/antonGritsenko/SF.EventSourceSample
Just run it and you will find some "The parameters to the Event method do not match the parameters to the WriteEvent method. This may cause the event to be displayed incorrectly." in output and nothing in Diagnostic Events.

I will try to migrate this project to API v3 to check if it the same.

@antonGritsenko
Copy link
Author

well, sorry, my mistake - sample project already with the latest API.

@karolz-ms
Copy link

I cannot reproduce the issue using the project you provided, sorry.

On my machine I did uninstall previous SF SDK and SF runtime, installed the latest one using Web Platform Installer & run the app. The only change that I made was to set the platform for the service project to x64, which is a common SF requirement as you probably know.

Can you try on a different machine?

@antonGritsenko
Copy link
Author

Hm, this is interesting. So everything works for you including events in Diagnostic Events window in Visual Studio?

@karolz-ms
Copy link

@antonGritsenko that is correct

@antonGritsenko
Copy link
Author

Sorry for silence, I need some time to prepare new machine

@wminos
Copy link

wminos commented Mar 30, 2018

I do not know if I understand this article correctly,
But I also don't see any Logs generated by ILogger in Diagnostic Events.
(CustomEventSource is implemented, .AddEventSourceLogger is added, And Add ETW Provider name(EventSource) is inputed at Diagnostic Events Configure)

@karolz-ms
Copy link

@wminos the name of the EventSource that EventSourceLogger is using is "Microsoft-Extensions-Logging". Can you confirm you have included that EventSource in the Diagnostic Events window configuration?

@mgrishkov
Copy link

You have to specify event source with leading asterisk to catch events. Something like '*Microsoft-Extensions-Logging'

@karolz-ms
Copy link

@mgrishkov no you don't, not inside Visual Studio. Visual Studio does not require the asterisk for Event Sources in the Diagnostic Events window.

@wminos
Copy link

wminos commented Apr 3, 2018

@karolz-ms Thank you.
But after I add 'Microsoft-Extensions-Logging' at ETW Providers configure,
Below error occurs. And ILogger logs are empty. (both My Application And SF.EventSourceSample)
(No error message found anywhere.)

errormessage

{
  "Timestamp": "2018-04-02T08:21:07.410383Z",
  "ProviderName": null,
  "Id": 0,
  "Message": "The Diagnostics Events is disconnected from the ETW sources.",
  "ProcessId": 0,
  "Level": null,
  "Keywords": null,
  "EventName": "ETW LISTENER ERROR MESSAGE",
  "ActivityID": null,
  "RelatedActivityID": null,
  "Payload": {}
}

{
  "Timestamp": "2018-04-02T08:21:07.411384Z",
  "ProviderName": null,
  "Id": 0,
  "Message": "Connection will be retried in 5 seconds",
  "ProcessId": 0,
  "Level": null,
  "Keywords": null,
  "EventName": "ETW LISTENER ERROR MESSAGE",
  "ActivityID": null,
  "RelatedActivityID": null,
  "Payload": {}
}

@karolz-ms
Copy link

These errors are usually transient and VS should be able to recover. Would it be possible for you to share an application that exhibits the problem, so that I can try to reproduce it myself?

@wminos
Copy link

wminos commented Apr 4, 2018

@karolz-ms

Environment

  • Windows 10
  • Service Fabric SDK 3.0.480
  • Visual Studio 2017 15.6.4

This error occurs too at shared project by antonGritsenko.
(https://github.com/antonGritsenko/SF.EventSourceSample)

The problem still occurs.

@wminos
Copy link

wminos commented Apr 4, 2018

Just custom logging cause the above error. (ETW LISTENER ERROR MESSAGE)

For reference, the internal logs of the ASP.NET Core framework are displayed well as follows.

{
  "Timestamp": "2018-04-04T04:55:05.8425183Z",
  "ProviderName": "Microsoft-Extensions-Logging",
  "Id": 671,
  "Message": null,
  "ProcessId": 29384,
  "Level": "Always",
  "Keywords": "0x0000F0000000000C",
  "EventName": "ActivityJsonStop/Stop",
  "ActivityID": "//1/2/1",
  "RelatedActivityID": null,
  "Payload": {
    "ID": 2,
    "FactoryID": 1,
    "LoggerName": "Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvoker"
  }
}

@karolz-ms
Copy link

Sorry for late reply @wminos. I am able to reproduce the problem--looks like a bug in the VS diagnostics events window. Thank you for the report! I am going to pass this to the owners of the feature.

@wminos
Copy link

wminos commented Apr 20, 2018

I installed the latest version (Service Fabric SDK 3.1.262, Runtime 6.2.262), but there are still issues.

@kwaclaw
Copy link

kwaclaw commented Jun 4, 2018

Is this related to https://github.com/aspnet/Logging/issues/844 ?

@karolz-ms
Copy link

@kwaclaw to me aspnet/logging 844 looks like a separate issue. This kind of error message is usually a result of a bug in one of the EventSource's used by the application, and not an issue with the EventSourceLogger.

The issue described here is a bug in Visual Studio. If you pick up the latest VS 2017 update (or install latest SF tools for VS 2015, i.e. 283 or later), you should get the fix and the problem should go away.

@wminos
Copy link

wminos commented Jun 5, 2018

It seems to work normally in ServiceFabric SDK 3.1.283.

@amanbha amanbha closed this as completed Sep 11, 2018
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

6 participants