Rakesh Kumar
Rakesh Kumar

Reputation: 3129

Write IdentityServer4 logs to a log.txt file

We are using IdentityServer4 with ASP.NET Core. We want to write Identity Server's logs to an external file (i.g. log.txt). Can we do this via the log4net library?

Upvotes: 1

Views: 2801

Answers (2)

Jeroen
Jeroen

Reputation: 63719

From the relevant IdentityServer docs:

IdentityServer uses the standard logging facilities provided by ASP.NET Core.

So in essence, your question nearly duplicates this question about hooking up log4net in ASP.NET Core. The top answer for that question also explains how to add a rolling file appender, which is what you'd need to get what you want.

That basically answers your question as currently written. If you need more specific advise, I recommend asking a question with your current attempted code / steps to reproduce your scenario.

Upvotes: 1

mackie
mackie

Reputation: 5264

.Net Core has pretty good logging support straight out of the box.

Have a read of this: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/?tabs=aspnetcore2x

Upvotes: 0

Related Questions