.Net Core WebApiアクセスLog 4 Net


1.参照の追加
Install-Package log4net
2.log 4 net.を追加configプロファイル


  
  
    
      
    
    
    
      
      
      
        
      
    

    
      
      
      
      
      
      
      
      
        
      
    

    
    
      
      
      
      
    

  

3.Startup修正
public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
            repository = LogManager.CreateRepository("NETCoreRepository");
            XmlConfigurator.Configure(repository, new FileInfo("log4net.config"));
        }

4.クラス呼び出し
static ILog log = LogManager.GetLogger(Startup.repository.Name, typeof(AddressMatchService));
log.Info("helloworld");
AddressMatchService