using log4net;using log4net.Config; 
using System; 
using System.IO; 
using System.Reflection; 

namespace LoggingDemo.Log4Net
{
class Program { private static readonly ILog log = LogManager.GetLogger(typeof(Program));
static void Main(string[] args) { var logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly()); XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config")); log.Debug("Starting up"); log.Debug("Shutting down"); Console.ReadLine(); } } }

 

参考1:Log4Net 使用

参考2:.NET NLog 与 Log4net 与 Serilog 比较

 

  

 

posted on 2021-02-23 17:37  青叶煮酒  阅读(169)  评论(0编辑  收藏  举报