public static void WriteWebRequestLog(RequestLog log, string responseData) { try { if (_requstLogStorage == "0") { return; } if (_requstLogStorage == "1") { logService.AddRequestLog(log); } else if (_requstLogStorage == "2") { #region Log4net实体 WebApiRequestLogEntity entity = new WebApiRequestLogEntity { ApiDesc = log.ApiDesc, ApiStatus = log.ApiStatus ?? 0, ClientHeight = log.ClientHeight, ClientIp = log.ClientIp, ClientIpHttp = log.ClientIpHttp, ClientNetType = log.ClientNetType, ClientType = log.ClientType, ClientVersion = log.ClientVersion, ClientWidth = log.ClientWidth, Content = log.ApiDescDetail, CustomerGuid = log.CustomerGuid ?? Guid.Empty, CustomerId = log.CustomerId ?? 0, ElapsedMilliseconds = log.ElapsedMilliseconds, HttpMethod = log.HttpMethod, HttpStatus = log.HttpStatus, Imei = log.Imei, InterfaceVersion = log.InterfaceVersion, Lat = log.Lat, Lng = log.Lng, LocationType = log.LocationType, OtherHeader = log.OtherHeader, RequestCookie = log.RequestCookie, RequestData = log.RequestData, RequestTime = log.RequestTime, ResponseCookie = log.ResponseCookie, Route = log.Route, ServerName = log.ServerName, UserAgent = log.UserAgent, UserName = log.UserName, AppName = "C8", ModelName = "Api请求日志", Level = 1, IsFake = log.IsFake, GenerateTime = log.GenerateTime, ResponseData = responseData, Province = log.Province, City = log.City, District = log.District, ProvinceCode = log.ProvinceCode, DistrictCode = log.DistrictCode, CityCode = log.CityCode, Id = log.Id }; #endregion LogHelper.InfoFormat("API请求日志:\r\n{0}", entity.ToJsonString()); } } catch (Exception exception) { LogHelper.Error("请求日志持久化异常\r\n" + log.ToJsonString(), exception); } }