NLog 通过http保存日志

from:https://github.com/NLog/NLog/wiki/WebService-target

Example config:


    
        
             
            
        
    
    
      
    

Example API controller

public class LogMeController : ApiController
{
    /// 
    /// We need a complex type for modelbinding because 
    /// of content-type: "application/x-www-form-urlencoded" 
    /// in 
    /// 
    public class ComplexType
    {
        public string Param1 { get; set; }
        public string Param2 { get; set; }
    }

    /// 
    /// Post
    /// 
    public void Post([FromBody] ComplexType complexType)
    {
        //do something
    }
}

你可能感兴趣的:(NLog 通过http保存日志)