gpt4 book ai didi

c# - NLog:NLog 配置在哪里?

转载 作者:太空宇宙 更新时间:2023-11-03 18:57:05 26 4
gpt4 key购买 nike

我这样编码:

private static readonly ILogger Logger = LogManager.GetCurrentClassLogger();

public MyClass()
{
Console.Write("lol");
Logger.Debug("Debug test...");
Logger.Error("Debug test...");
Logger.Fatal("Debug test...");
Logger.Info("Debug test...");
Logger.Trace("Debug test...");
Logger.Warn("Debug test...");
}

没有任何显示.. 所以我被告知去添加 <targets>配置文件,问题是..配置文件在哪里?谷歌、文档或类似的东西对我没有任何帮助...

最佳答案

来自 NLog维基:

The following locations will be searched when executing a stand-alone *.exe application:

  • standard application configuration file (usually applicationname.exe.config)
  • applicationname.exe.nlog in application’s directory
  • NLog.config in application’s directory
  • NLog.dll.nlog in a directory where NLog.dll is located (only if NLog isn't installed in the GAC)

因此,最简单的方法是在应用程序目录中添加一个 NLog.config 文件

关于c# - NLog:NLog 配置在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42464439/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com