将 IdentityServer4 日志写入 log.txt 文件
Write IdentityServer4 logs to a log.txt file
我们正在使用具有 ASP.NET 核心的 IdentityServer4。我们想将 Identity Server 的日志写入外部文件 (i.g.log.txt
)。我们可以通过 log4net 库做到这一点吗?
.Net Core 具有非常好的开箱即用的日志记录支持。
读一读:https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?tabs=aspnetcore2x
来自the relevant IdentityServer docs:
IdentityServer uses the standard logging facilities provided by ASP.NET Core.
所以本质上,您的问题几乎重复 . The 该问题还解释了如何添加滚动文件附加程序,这是您获得所需内容所需要的。
这基本上回答了你目前所写的问题。如果您需要更具体的建议,我建议您询问有关您当前尝试的代码/步骤的问题,以重现您的场景。
我们正在使用具有 ASP.NET 核心的 IdentityServer4。我们想将 Identity Server 的日志写入外部文件 (i.g.log.txt
)。我们可以通过 log4net 库做到这一点吗?
.Net Core 具有非常好的开箱即用的日志记录支持。
读一读:https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?tabs=aspnetcore2x
来自the relevant IdentityServer docs:
IdentityServer uses the standard logging facilities provided by ASP.NET Core.
所以本质上,您的问题几乎重复
这基本上回答了你目前所写的问题。如果您需要更具体的建议,我建议您询问有关您当前尝试的代码/步骤的问题,以重现您的场景。