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

.net8 preview4 AOT windows service process, log component always writes to ETW #87769

Closed
xljiulang opened this issue Jun 19, 2023 · 7 comments
Closed
Assignees
Labels
area-NativeAOT-coreclr needs-author-action An issue or pull request that requires more info or actions from the author.
Milestone

Comments

@xljiulang
Copy link

Description

 var builder = WebApplication.CreateSlimBuilder(args);

 builder.Logging.ClearProviders();
 if (ServiceUtil.IsWindowsService() == false)
 {
     builder.Logging.AddConsole();
 }

If the above code is installed and run as a windows service after AOT, the log will always be written to ETW, but the JIT compilation behaves correctly.

Reproduction Steps

  1. clear all loger providers.
  2. build as AOT
  3. install and run as windows service

Expected behavior

Logs are not written to ETW

Actual behavior

Logs allway written to ETW

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jun 19, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jun 19, 2023
@vcsjones vcsjones removed the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jun 21, 2023
@tommcdon
Copy link
Member

@LakshanF do we plan on doing the work in Native AOT to support ETW?

@tommcdon tommcdon added this to the 8.0.0 milestone Jul 19, 2023
@tommcdon tommcdon removed the untriaged New issue has not been triaged by the area owner label Jul 19, 2023
@tommcdon
Copy link
Member

@LakshanF would you mind taking a look?

@LakshanF
Copy link
Member

LakshanF commented Jul 20, 2023

@xljiulang, would you be able to give more details of this issue please? We made some recent changes and I would like to understand the impact on your application.

  • ETW Provider is opt-in for NativeAOT, similar to the EventPipe provider. PR Make firing of ETW events in nativeaot opt-in via the enabled/disabled lib #88800 made this change. in .NET Applications, both providers are already opted in.
  • Setting the EventSourceSupport property to true in your application project file will make both providers (ETW and EventPipe) opted in for your application.
  • Not all events are enabled in the ETWProvider for NativeAOT.

Knowing your scenario in detail - ETW events that are important to your application, detailed instructions for the repro of your application - will help us triage this issue for .NET8 release.

Thanks!

@tommcdon tommcdon added the needs-author-action An issue or pull request that requires more info or actions from the author. label Jul 24, 2023
@ghost
Copy link

ghost commented Jul 24, 2023

This issue has been marked needs-author-action and may be missing some important information.

@ghost
Copy link

ghost commented Jul 25, 2023

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

 var builder = WebApplication.CreateSlimBuilder(args);

 builder.Logging.ClearProviders();
 if (ServiceUtil.IsWindowsService() == false)
 {
     builder.Logging.AddConsole();
 }

If the above code is installed and run as a windows service after AOT, the log will always be written to ETW, but the JIT compilation behaves correctly.

Reproduction Steps

  1. clear all loger providers.
  2. build as AOT
  3. install and run as windows service

Expected behavior

Logs are not written to ETW

Actual behavior

Logs allway written to ETW

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Author: xljiulang
Assignees: LakshanF
Labels:

area-NativeAOT-coreclr, needs-author-action

Milestone: 8.0.0

@ghost ghost added the no-recent-activity label Aug 8, 2023
@ghost
Copy link

ghost commented Aug 8, 2023

This issue has been automatically marked no-recent-activity because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove no-recent-activity.

@xljiulang
Copy link
Author

@LakshanF
Sorry, I found out that this is the default logging behavior of the UseWindowsService() extension, which always calls logging.AddEventLog() when a windows service is eligible.

@ghost ghost removed the no-recent-activity label Aug 11, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Sep 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-NativeAOT-coreclr needs-author-action An issue or pull request that requires more info or actions from the author.
Projects
Archived in project
Development

No branches or pull requests

6 participants