dotnet / dotnet/aspnetcore

Docker log duplication in VS

Open
#7,507 0 comments 0 reactions 0 assignees View on GitHub
affected-very-few area-hosting area-networking enhancement severity-nice-to-have
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

Docker logs are duplicated in VS when you run under the debugger (F5). The two loggers are the console logger and the debug logger. Both logs are routed to the VS Debug output window. We should find a way to detect this and suppress the console logger.

Generic host 3.0.0-preview3:
```
Microsoft.Hosting.Lifetime: Information: Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
Microsoft.Hosting.Lifetime: Information: Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
Content root path: /app
Microsoft.Hosting.Lifetime: Information: Content root path: /app
The program '[314] dotnet' has exited with code 0 (0x0).
The program 'dotnet' has exited with code 0 (0x0).
```

Side note: the control characters are the console color markers. https://github.com/aspnet/Extensions/issues/673

WebHost (3.0.0-preview1):
```
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 GET https://localhost:44330/
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET https://localhost:44330/
Loaded '/usr/share/dotnet/shared/Microsoft.AspNetCore.App/2.2.2/Microsoft.AspNetCore.WebUtilities.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 116.2878ms 200
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 116.2878ms 200
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET https://localhost:44330/favicon.ico
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 GET https://localhost:44330/favicon.ico
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 15.0096ms 200
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 15.0096ms 200
```

@glennc

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.