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 比较

 

  

 

相关文章:

  • 2022-12-23
  • 2021-12-06
  • 2022-02-16
  • 2021-11-15
  • 2021-08-07
  • 2022-12-23
  • 2021-06-11
  • 2021-10-20
猜你喜欢
  • 2021-07-19
  • 2022-01-11
  • 2021-09-07
  • 2021-11-09
  • 2022-12-23
  • 2021-10-24
相关资源
相似解决方案