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
Copy file name to clipboardExpand all lines: src/content/docs/identityserver/diagnostics/logging.md
+94-2Lines changed: 94 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,10 +51,102 @@ In production, logging might produce too much data. It is recommended you either
51
51
instrumentation.
52
52
:::
53
53
54
+
### Setup for Microsoft.Extensions.Logging
55
+
56
+
.NET provides a logging abstraction interface found in the
57
+
[`Microsoft.Extensions.Logging`](https://www.nuget.org/packages/Microsoft.Extensions.Logging) package and is the default logging provider for ASP.NET Core.
58
+
59
+
If you prefer to use Microsoft's logging option,
60
+
you can remove references to Serilog and fall back to the default logging implementation.
61
+
Duende IdentityServer already uses the `ILogger` interface,
62
+
and will use any implementation registered with the services collection.
63
+
64
+
Below you will find a modified version of the in-memory Duende IdentityServer sample.
65
+
You can use it as a guide to adapt your own instance of Duende IdentityServer to use Microsoft's logging implementation..
You will also need to modify the `appSettings.json` file to include the `Logging` section:
123
+
124
+
```json
125
+
{
126
+
"Logging": {
127
+
"LogLevel": {
128
+
"Default": "Information",
129
+
"Microsoft": "Warning",
130
+
"Microsoft.Hosting.Lifetime": "Information",
131
+
"Duende.IdentityServer": "Information"
132
+
}
133
+
},
134
+
"AllowedHosts": "*"
135
+
}
136
+
```
137
+
138
+
Learn more about configuring logging in .NET applications by reading the [Microsoft documentation on logging fundamentals](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-9.0#configure-logging). As you'll see in the Microsoft documentation, configuring logging can be very involved and target different log levels, which can be useful for troubleshooting.
139
+
54
140
### Setup For Serilog
55
141
56
-
We personally like [Serilog](https://serilog.net) and
57
-
the [Serilog.AspNetCore](https://github.com/serilog/serilog-aspnetcore) package a lot. Give it a try:
142
+
[Serilog](https://serilog.net) is a trusted and popular logging library for .NET applications.
143
+
It is highly configurable,
144
+
and at Duende, we think it is a **great alternative** to the default logging
145
+
implementation,
146
+
especially for .NET developers looking for more control over their logging configuration.
147
+
Additionally,
148
+
ASP.NET Core developers can use the [Serilog.AspNetCore](https://github.com/serilog/serilog-aspnetcore) for
149
+
better integration with ASP.NET Core applications.
0 commit comments