'LogManager'是.LogManagers之间的模糊引用

use*_*979 0 c# logging nlog common.logging

我收到错误消息,"错误19'LogManager'是'Common.Logging.LogManager'和'NLog.LogManager'之间的模糊引用".

在C#2008应用程序中,我尝试将nlog开源日志记录工具添加到已经使用从以下位置获取的common.logging的应用程序:http://netcommon.sourceforge.net.

我添加了对NLog文件的引用,并将Nlog添加到using语句中.

问题是两个工具都使用一个名为"LogManager"的对象.

那么你能告诉我如何解决我的问题所以我可以使用两个Logmanagers.

以下是我列出的代码:xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance">

   using System;
     using System.Collections.Generic;
     using System.Linq;
     using System.Text;
     using Common.Logging;
     using sample;
     using System.Configuration;
     using System.Xml.Linq;  
     using NLog;

namespace sample
{
  public class Etest
  {
    private static Logger logger = LogManager.GetCurrentClassLogger(); 
    private static ILog log = LogManager.GetCurrentClassLogger();
  }
}
Run Code Online (Sandbox Code Playgroud)

Qui*_*son 5

您只需要确保通话合格.

public class Etest
{
   private static Logger logger = NLog.LogManager.GetCurrentClassLogger(); 
   private static ILog log = Common.Logging.LogManager.GetCurrentClassLogger();
}
Run Code Online (Sandbox Code Playgroud)