一兄裂,安裝Nlog
這里使用Nuget添加Nlog的引用,在項(xiàng)目上右鍵->管理Nuget程序包阳藻,輸入nlog查找晰奖,然后點(diǎn)擊安裝
二,nlog的使用
先在bin/debug下面添加配置文件:Nlog.config腥泥,名字不能變匾南,只能是它,(簡書的文本編輯器不能粘xml蛔外,所以只能截圖了)
測(cè)試代碼
using NLog;
namespace ExcelReadTool.service
{
? ? class LogTest
? ? {
? ? ? ? private static Logger logger = LogManager.GetCurrentClassLogger();
? ? ? ? public static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? logger.Info("nlog test1");
? ? ? ? }
? ? }
}