Log4Net登录到特定的Appender .NET Core

问题描述 投票:0回答:1

使用.NET Core,C#,Log4Net 2.0.8

我正在尝试登录其他Appender,但是由于某种原因,没有log4net.LogManager.GetLogger(string),只有log4net.LogManager.GetLogger(type)。

我举了一个例子:Log4net - Logging to wrong appender

我希望从一个班级登录:

private static readonly ILog logA = LogManager.GetLogger("LogA");
log.Debug("This should log to LogA");

并且在另一个其他班级:

private static readonly ILog logB = LogManager.GetLogger("LogB");
log.Debug("This should log to LogB");

我已经尝试根据https://logging.apache.org/log4net/release/manual/introduction.html来理解Log4Net。>

但该示例还涉及:

ILog x = LogManager.GetLogger("wombat");
ILog y = LogManager.GetLogger("wombat");

我如何登录特定的Appender?谢谢

使用.NET Core,C#,Log4Net 2.0.8,我试图登录到其他Appender,但是由于某种原因,没有log4net.LogManager.GetLogger(string),只有log4net.LogManager.GetLogger(type)。我...

c# .net-core log4net
1个回答
0
投票

您需要使用GetLogger(Assembly repositoryAssembly, string name)重载,请参阅spec

© www.soinside.com 2019 - 2024. All rights reserved.