Sfoglia il codice sorgente

添加日志功能

zhangkun 5 anni fa
parent
commit
f79b358688

+ 135 - 0
web/BaseCallCenter.Common/LogHelper.cs

@@ -0,0 +1,135 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Text;
4
+using System.IO;
5
+using log4net;
6
+
7
+namespace YTSoft.Common
8
+{
9
+    public class LogHelper
10
+    {
11
+        private ILog _log4Net = null;
12
+        private const string DEFAULT_LOGGER_NAME = "Logger";
13
+        /// <summary>
14
+        /// Prevents a default instance of the <see cref="LogWriter"/> class from being created.
15
+        /// </summary>
16
+        /// <param name="log4NetInstance">The log4net instance to be used.</param>
17
+        private LogHelper(ILog log4NetInstance)
18
+        {
19
+            _log4Net = log4NetInstance;
20
+        }
21
+
22
+        /// <summary>
23
+        /// Gets a logger with the specified configuration name.
24
+        /// </summary>
25
+        /// <param name="configName">Name of the logger in the configuration.</param>
26
+        /// <returns>The logger obtained.</returns>
27
+        /// <exception cref="System.Configuration.ConfigurationException">Thrown when no logger with the specified configuration name was found.</exception>
28
+        public static LogHelper GetLogger(string configName)
29
+        {
30
+            var logger = LogManager.GetLogger(configName);
31
+            if (logger == null)
32
+            {
33
+                throw new ArgumentException(string.Format("No logger configuration named '{0}' was found in the configuration.", configName), "configName");
34
+            }
35
+            return new LogHelper(logger);
36
+        }
37
+
38
+        /// <summary>
39
+        /// Gets the default.
40
+        /// </summary>
41
+        public static LogHelper Default
42
+        {
43
+            get
44
+            {
45
+                return GetLogger(DEFAULT_LOGGER_NAME);
46
+            }
47
+        }
48
+
49
+        /// <summary>
50
+        /// Writes an information level logging message.
51
+        /// </summary>
52
+        /// <param name="message">The message to be written.</param>
53
+        public void WriteInfo(object message)
54
+        {
55
+            _log4Net.Info(message);
56
+        }
57
+
58
+        /// <summary>
59
+        /// Writes a warning level logging message.
60
+        /// </summary>
61
+        /// <param name="message">The message to be written.</param>
62
+        public void WriteWarning(object message)
63
+        {
64
+            _log4Net.Warn(message);
65
+        }
66
+
67
+        /// <summary>
68
+        /// Writes a warning level logging message.
69
+        /// </summary>
70
+        /// <param name="message">The message to be written.</param>
71
+        /// <param name="exception">The exception.</param>
72
+        public void WriteWarning(object message, System.Exception exception)
73
+        {
74
+            _log4Net.Warn(message, exception);
75
+        }
76
+
77
+        /// <summary>
78
+        /// Writes the error.
79
+        /// </summary>
80
+        /// <param name="message">The message to be written.</param>
81
+        public void WriteError(object message)
82
+        {
83
+            _log4Net.Error(message);
84
+        }
85
+
86
+        /// <summary>
87
+        /// Writes the error level logging message..
88
+        /// </summary>
89
+        /// <param name="message">The message to be written.</param>
90
+        /// <param name="exception">The exception.</param>
91
+        public void WriteError(object message, System.Exception exception)
92
+        {
93
+            _log4Net.Error(message, exception);
94
+        }
95
+
96
+        /// <summary>
97
+        /// Writes the fatal error level logging message..
98
+        /// </summary>
99
+        /// <param name="message">The message to be written.</param>
100
+        public void WriteFatal(object message)
101
+        {
102
+            _log4Net.Fatal(message);
103
+        }
104
+
105
+        /// <summary>
106
+        /// Writes the fatal error level logging message..
107
+        /// </summary>
108
+        /// <param name="message">The message to be written.</param>
109
+        /// <param name="exception">The exception.</param>
110
+        public void WriteFatal(object message, System.Exception exception)
111
+        {
112
+            _log4Net.Fatal(message, exception);
113
+        }
114
+
115
+        public void DeleteLog()
116
+        {
117
+            string logDirPath = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "Log");
118
+            if (!Directory.Exists(logDirPath)) return;
119
+            int days = 30;
120
+            foreach (string filePath in Directory.GetFiles(logDirPath))
121
+            {
122
+                DateTime dt;
123
+                DateTime.TryParse(Path.GetFileNameWithoutExtension(filePath).Replace(@"Log\", "").Replace(".", "-"), out dt);
124
+                if (dt.AddDays(days).CompareTo(DateTime.Now) < 0)
125
+                {
126
+                    File.Delete(filePath);
127
+                }
128
+            }
129
+        }
130
+    }
131
+
132
+
133
+
134
+
135
+}

+ 4 - 0
web/BaseCallCenter.Common/YTSoft.Common.csproj

@@ -46,6 +46,9 @@
46 46
     <Reference Include="Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL">
47 47
       <HintPath>..\packages\Ionic.Zip.1.9.1.8\lib\Ionic.Zip.dll</HintPath>
48 48
     </Reference>
49
+    <Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
50
+      <HintPath>..\packages\log4net.2.0.12\lib\net40\log4net.dll</HintPath>
51
+    </Reference>
49 52
     <Reference Include="NPOI">
50 53
       <HintPath>..\DLL\NPOI.dll</HintPath>
51 54
     </Reference>
@@ -93,6 +96,7 @@
93 96
     <Compile Include="MySystem.cs" />
94 97
     <Compile Include="StringHelper.cs" />
95 98
     <Compile Include="StringUtil.cs" />
99
+    <Compile Include="LogHelper.cs" />
96 100
     <Compile Include="SysLog.cs" />
97 101
     <Compile Include="Thumbnail.cs" />
98 102
     <Compile Include="Utils.cs" />

+ 1 - 0
web/BaseCallCenter.Common/packages.config

@@ -2,5 +2,6 @@
2 2
 <packages>
3 3
   <package id="ICSharpCode.SharpZipLib.dll" version="0.85.4.369" targetFramework="net40" />
4 4
   <package id="Ionic.Zip" version="1.9.1.8" targetFramework="net40" />
5
+  <package id="log4net" version="2.0.12" targetFramework="net40" />
5 6
   <package id="SharpZipLib" version="0.86.0" targetFramework="net40" />
6 7
 </packages>

+ 1 - 1
web/YTSoft.BaseCallCenter.MVCWeb/App_Start/RouteConfig.cs

@@ -16,7 +16,7 @@ namespace YTSoft.BaseCallCenter.MVCWeb
16 16
             routes.MapRoute(
17 17
                 name: "Default",
18 18
                 url: "{controller}/{action}/{id}",
19
-                defaults: new { controller = "Default", action = "Login", id = UrlParameter.Optional }
19
+                defaults: new { controller = "Default", action = "SSO", id = UrlParameter.Optional }
20 20
             );
21 21
 
22 22
         }

+ 11 - 0
web/YTSoft.BaseCallCenter.MVCWeb/Controllers/BaseController.cs

@@ -329,6 +329,17 @@ namespace YTSoft.BaseCallCenter.MVCWeb.Controllers
329 329
         {
330 330
             return bll_T_Sys_SystemConfig.GetParamValueByParamCode(key);
331 331
         }
332
+
333
+
334
+        /// <summary>
335
+        /// 数据库日志
336
+        /// </summary>
337
+        /// <param name="TableName"></param>
338
+        /// <param name="id"></param>
339
+        /// <param name="ActionName"></param>
340
+        /// <param name="oldobj"></param>
341
+        /// <param name="newobj"></param>
342
+        /// <returns></returns>
332 343
         public bool AddLog(string TableName, string id,string ActionName,string oldobj,object newobj)
333 344
         {
334 345
             Model.T_Com_LogAction modellog = new T_Com_LogAction();

+ 24 - 0
web/YTSoft.BaseCallCenter.MVCWeb/Controllers/DefaultController.cs

@@ -232,5 +232,29 @@ namespace YTSoft.BaseCallCenter.MVCWeb.Controllers
232 232
             return res;
233 233
         }
234 234
 
235
+
236
+
237
+
238
+        public ActionResult SSO()
239
+        {
240
+            T_Sys_UserAccount userInfo = new T_Sys_UserAccount();
241
+            HttpCookie cookies = Request.Cookies["platform"];
242
+            //判断是否有cookie值,有的话就读取出来
243
+            if (cookies != null && cookies.HasKeys)
244
+            {
245
+                userInfo.F_UserName = cookies["Name"];
246
+
247
+            }
248
+            try
249
+            {
250
+                int a = 3 / 4;
251
+                int r = 4 / a;
252
+            }
253
+            catch (Exception ex)
254
+            {
255
+                LogHelper.Default.WriteError(ex.Message, ex);
256
+            }
257
+            return View(userInfo);
258
+        }
235 259
     }
236 260
 }

+ 18 - 18
web/YTSoft.BaseCallCenter.MVCWeb/Controllers/Report/ReportController.cs

@@ -4219,26 +4219,26 @@ BType, case when (isnull(BusinessType,0)>0 or isnull(F_ServiceType,0)>0) then '
4219 4219
                         totalCount6 = (int)totalCount5 / totalCount2;
4220 4220
                     }
4221 4221
                     #region  计算流失率  通过率
4222
-                    string startDatestr = "";
4223
-                    string endDatestr = "";
4224
-                    if (!string.IsNullOrEmpty(startDate))
4225
-                    {
4226
-                        startDatestr=" and BeginTime>='" + startDate + "  00:00:00' ";
4227
-                    }
4228
-                    if (!string.IsNullOrEmpty(endDate))
4229
-                    {
4230
-                        endDatestr=" and BeginTime<='" + endDate + " 23:59:59' ";
4231
-                    }
4232
-                    decimal ls= recordBLL.GetRecordCount(string.Format("Userid={0} and RingLongTime>3 and CallState=0 {1} {2}", row["F_UserId"], startDatestr, endDatestr));
4233
-                    decimal tg =recordBLL.GetRecordCount(string.Format("Userid={0} and CallState=1 {1} {2}", row["F_UserId"], startDatestr, endDatestr));
4234
-                    decimal zs = 1.00M*recordBLL.GetRecordCount(string.Format("Userid={0} {1} {2}", row["F_UserId"], startDatestr, endDatestr));
4222
+                    //string startDatestr = "";
4223
+                    //string endDatestr = "";
4224
+                    //if (!string.IsNullOrEmpty(startDate))
4225
+                    //{
4226
+                    //    startDatestr=" and BeginTime>='" + startDate + "  00:00:00' ";
4227
+                    //}
4228
+                    //if (!string.IsNullOrEmpty(endDate))
4229
+                    //{
4230
+                    //    endDatestr=" and BeginTime<='" + endDate + " 23:59:59' ";
4231
+                    //}
4232
+                    //decimal ls= recordBLL.GetRecordCount(string.Format("Userid={0} and RingLongTime>3 and CallState=0 {1} {2}", row["F_UserId"], startDatestr, endDatestr));
4233
+                    //decimal tg =recordBLL.GetRecordCount(string.Format("Userid={0} and CallState=1 {1} {2}", row["F_UserId"], startDatestr, endDatestr));
4234
+                    //decimal zs = 1.00M*recordBLL.GetRecordCount(string.Format("Userid={0} {1} {2}", row["F_UserId"], startDatestr, endDatestr));
4235 4235
                     string lsl = "0%";//流失率
4236 4236
                     string jtl = "0%";//通过率
4237
-                    if (zs!=0)
4238
-                    {
4239
-                         lsl = (ls / zs).ToString("P");
4240
-                         jtl = (tg / zs).ToString("P");
4241
-                    }                   
4237
+                    //if (zs!=0)
4238
+                    //{
4239
+                    //     lsl = (ls / zs).ToString("P");
4240
+                    //     jtl = (tg / zs).ToString("P");
4241
+                    //}                   
4242 4242
                     #endregion
4243 4243
 
4244 4244
 

+ 5 - 1
web/YTSoft.BaseCallCenter.MVCWeb/Global.asax.cs

@@ -1,11 +1,12 @@
1 1
 using System;
2 2
 using System.Collections.Generic;
3
+using System.IO;
3 4
 using System.Linq;
4 5
 using System.Web;
5 6
 using System.Web.Http;
6 7
 using System.Web.Mvc;
7 8
 using System.Web.Routing;
8
-
9
+using YTSoft.Common;
9 10
 
10 11
 namespace YTSoft.BaseCallCenter.MVCWeb
11 12
 {
@@ -20,6 +21,9 @@ namespace YTSoft.BaseCallCenter.MVCWeb
20 21
             WebApiConfig.Register(System.Web.Http.GlobalConfiguration.Configuration);
21 22
             FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
22 23
             RouteConfig.RegisterRoutes(RouteTable.Routes);
24
+
25
+            log4net.Config.XmlConfigurator.Configure(new FileInfo(Server.MapPath("~/log4net.config")));
26
+
23 27
         }
24 28
     }
25 29
 }

+ 173 - 0
web/YTSoft.BaseCallCenter.MVCWeb/Views/Default/SSO.cshtml

@@ -0,0 +1,173 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+
4
+<head>
5
+  <meta charset="UTF-8" />
6
+  <title>郑州市轨道交通全媒体客服平台</title>
7
+  <meta name="keywords" content="郑州市轨道交通全媒体客服平台" />
8
+  <meta name="description" content="郑州市轨道交通全媒体客服平台" />
9
+  <meta name="renderer" content="webkit" />
10
+  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
11
+  <meta name="Author" content="larry" />
12
+  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
13
+  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
14
+  <meta name="apple-mobile-web-app-capable" content="yes" />
15
+  <meta name="format-detection" content="telephone=no" />
16
+  <link rel="Shortcut Icon" href="favicon.ico" />
17
+
18
+  <link href="~/Content/layui/css/layui.css" rel="stylesheet" />
19
+  <link rel="stylesheet" type="text/css" href="/Content/css/gobal.css" media="all" />
20
+  <link rel="stylesheet" type="text/css" href="/Content/css/animate.css" media="all" />
21
+  <link rel="stylesheet" type="text/css" href="/Content/css/metrologin.css" media="all" />
22
+</head>
23
+
24
+<body>
25
+  <div class="larry-main layui-layout animated shake larry-delay2" id="larry_login"
26
+    style="margin-top: 100px; margin-bottom:50px;">
27
+    <div class="title">
28
+      <img src="/Content/images/logo2.png" style="height:160px;" alt="">
29
+    </div>
30
+    <div class="user-info">
31
+      <div style="height:120px;">&nbsp;</div>
32
+      <div class="avatar" style=" width:250px; height:50px;">
33
+        <p class="info" style="font-size:20pt;">
34
+          全媒体客服平台
35
+        </p>
36
+      </div>
37
+      <div class="layui-form" id="larry_form">
38
+        <div class="layui-form-item">
39
+          <label class="layui-form-label">
40
+            用户名:
41
+          </label>
42
+          <input id="txtusername" type="text" name="user_name" required lay-verify="required" aautocomplete="off"
43
+            class="layui-input larry-input" placeholder="请输入您的用户名" value="@Model.F_UserName" autocomplete="off">
44
+        </div>
45
+        <div class="layui-form-item" id="password">
46
+          <label class="layui-form-label">
47
+            密&nbsp;&nbsp;&nbsp;码:
48
+          </label>
49
+          <input id="txtpassword" type="password" name="password" required lay-verify="required|password"
50
+            aautocomplete="off" class="layui-input larry-input" placeholder="请输入您的登录密码" autocomplete="off"
51
+            value="hot123456">
52
+        </div>
53
+        <div class="layui-form-item">
54
+          <button class="layui-btn larry-btn" onclick="EventLoginIn();">
55
+            立即登录
56
+          </button>
57
+        </div>
58
+        <div class="layui-form-item">
59
+          <span id="lblTip" style="color:Red;">&nbsp;</span>
60
+        </div>
61
+      </div>
62
+    </div>
63
+    <div class="copy-right" style=" color:White;">
64
+      © 版权所有 郑州市轨道交通
65
+    </div>
66
+  </div>
67
+  <!-- 加载js文件-->
68
+
69
+  <script src="~/Content/layui/layui.js"></script>
70
+  <script src="~/Content/js/ytsoft.config.js"></script>
71
+  <script src="~/Content/js/jquery-1.8.3.min.js"></script>
72
+  <script src="~/Content/js/ytsoft.http.js"></script>
73
+
74
+  <div class="layui-layer-move">
75
+    <ul style="visibility: visible;" id="supersized" class="quality">
76
+      <li style="visibility: visible; opacity: 1;" class="slide-0 activeslide">
77
+        <a target="_blank">
78
+          <img id="bgimage1" src="/Content/images/login/7.jpg" style="width: 100%;" />
79
+        </a>
80
+      </li>
81
+      <li style="visibility: visible;
82
+                    opacity: 1;" class="slide-1">
83
+        <a target="_blank">
84
+          <img src="/Content/images/login/1.jpg" />
85
+        </a>
86
+      </li>
87
+      <li style="visibility: visible; opacity: 1;" class="slide-2 prevslide">
88
+        <a target="_blank">
89
+          <img src="/Content/images/login/2.jpg" />
90
+        </a>
91
+      </li>
92
+    </ul>
93
+  </div>
94
+  <script type="text/javascript">
95
+    //获取url中的参数
96
+    function getUrlParam(name) {
97
+      var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
98
+      var r = window.location.search.substr(1).match(reg);  //匹配目标参数
99
+      if (r != null) return unescape(r[2]); return null; //返回参数值
100
+    }
101
+  </script>
102
+  <script type="text/javascript">
103
+    function EventLoginIn() {
104
+      var IsVerification = verification();
105
+      if (IsVerification == true) {
106
+        var username = document.getElementById("txtusername").value;
107
+        if (getUrlParam("ExtPhone") != null) {
108
+          extensionphone = getUrlParam("ExtPhone");
109
+        } else {
110
+          var extensionphone = "0000";
111
+        }
112
+        var password = document.getElementById("txtpassword").value; //todo,这里需加密
113
+        var params = "username=" + username + "&extensionphone=" + extensionphone + "&password=" + escape(password);
114
+
115
+        console.log(params)
116
+        debugger
117
+        $.post("/Default/LoginIn/?" + params, function (data, states) {
118
+          if (states == "success") {
119
+            //if (data.length > 10) {
120
+            //    var newdata = data.substr(0, 10);
121
+            //if (newdata == "firstlogin") {
122
+            //    $.ligerDialog.open({
123
+            //        url: 'firstlogin.aspx?ResetPass=' + data.substr(10, data.length - 10),
124
+            //        title: '修改初始密码',
125
+            //        height: 400,
126
+            //        width: 500,
127
+            //        isResize: true
128
+            //    });
129
+            //}
130
+            //else {
131
+            //lblTip.innerHTML = "登录失败,用户名密码错误或数据库连接异常";
132
+            //document.getElementById("txtUserPwd").focus();
133
+            //WriteFileLogs(3, "login.aspx", data);
134
+            //}
135
+            //}
136
+            //else {
137
+            if (data == "success") {
138
+              location.href = "/Main/Index";
139
+              helper.cookies.set('callState', 1);
140
+              helper.cookies.set('clsCookie', "");
141
+            }
142
+            else {
143
+              lblTip.innerHTML = "登录失败,用户名密码错误或数据库连接异常";
144
+              document.getElementById("txtpassword").focus();
145
+            }
146
+            //}
147
+          }
148
+        })
149
+      }
150
+    }
151
+    function verification() {
152
+      if (document.getElementById("txtusername").value == "") {
153
+        document.getElementById("lblTip").innerHTML = "&nbsp;*&nbsp;请输入您的用户名";
154
+        document.getElementById("txtusername").focus();
155
+        return false;
156
+      }
157
+      else if (document.getElementById("txtpassword").value == "") {
158
+        document.getElementById("lblTip").innerHTML = "&nbsp;*&nbsp;请输入您的登录密码";
159
+        document.getElementById("txtpassword").focus();
160
+        return false;
161
+      }
162
+      return true;
163
+    }
164
+    document.onkeydown = function (event) {
165
+      var e = event || window.event || arguments.callee.caller.arguments[0];
166
+      if (e && e.keyCode == 13) {
167
+        EventLoginIn();
168
+      }
169
+    };
170
+  </script>
171
+</body>
172
+
173
+</html>

+ 5 - 0
web/YTSoft.BaseCallCenter.MVCWeb/YTSoft.BaseCallCenter.MVCWeb.csproj

@@ -43,6 +43,9 @@
43 43
     <WarningLevel>4</WarningLevel>
44 44
   </PropertyGroup>
45 45
   <ItemGroup>
46
+    <Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
47
+      <HintPath>..\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
48
+    </Reference>
46 49
     <Reference Include="Microsoft.CSharp" />
47 50
     <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
48 51
       <HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
@@ -1535,6 +1538,7 @@
1535 1538
     <Content Include="Content\layui\ueditor\third-party\video-js\font\vjs.eot" />
1536 1539
     <Content Include="Content\layui\ueditor\third-party\video-js\font\vjs.ttf" />
1537 1540
     <Content Include="Content\layui\ueditor\third-party\video-js\font\vjs.woff" />
1541
+    <Content Include="log4net.config" />
1538 1542
     <None Include="Properties\PublishProfiles\11.pubxml" />
1539 1543
     <Content Include="Views\SystemManage\RoleList.cshtml" />
1540 1544
     <Content Include="Views\SystemManage\BusinessTypeList.cshtml" />
@@ -1644,6 +1648,7 @@
1644 1648
     <Content Include="Views\Class\GetList.cshtml" />
1645 1649
     <Content Include="Views\Class\NoticeEdit.cshtml" />
1646 1650
     <Content Include="Views\WorkOrder\WorkOrderMyListDZ.cshtml" />
1651
+    <Content Include="Views\Default\SSO.cshtml" />
1647 1652
   </ItemGroup>
1648 1653
   <ItemGroup>
1649 1654
     <ProjectReference Include="..\BaseCallCenter.BLL\YTSoft.BaseCallCenter.BLL.csproj">

+ 43 - 0
web/YTSoft.BaseCallCenter.MVCWeb/log4net.config

@@ -0,0 +1,43 @@
1
+<?xml version="1.0" encoding="utf-8" ?>
2
+<configuration>
3
+  <configSections>
4
+    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net-net-2.0"/>
5
+  </configSections>
6
+  <log4net>
7
+    <root>
8
+      <level value="ALL" />
9
+      <appender-ref ref="LogFileAppender" />
10
+      <!--<appender-ref ref="EventLogAppender" />-->
11
+    </root>
12
+    <!--定义输出到文件-->
13
+    <appender name ="LogFileAppender" type="log4net.Appender.RollingFileAppender">
14
+      <!--定义文件存放位置-->
15
+      <param name="File" value ="App_Data\"/>
16
+      <param name="AppendToFile" value="true" />
17
+      <param name="MaxSizeRollBackups" value="100" />
18
+      <param name="MaxFileSize" value="10240" />
19
+      <param name="StaticLogFileName" value="false" />
20
+      <!--文件名格式-->
21
+      <param name="DatePattern" value="yyyy.MM.dd'.txt'" />
22
+      <param name="RollingStyle" value ="Date" />
23
+      <!--不以独占方式记录日志,仅在记录每个日志的最短时间内锁定,因为部署到服务器上遇到了文件被占用无法下载日志-->
24
+      <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
25
+      <layout type="log4net.Layout.PatternLayout">
26
+        <!--定义输出格式-->
27
+        <!--示例 2018-08-20 12:10:49,348 -线程ID:[21] 日志级别:[INFO ] : [日志信息]-->
28
+        <param name="ConversionPattern" value="%date 线程ID:[%thread] 日志级别:[%-5level] : [%message]%newline"/>
29
+      </layout>
30
+      <!--过滤级别 FATAL > ERROR > WARN > INFO > DEBUG-->
31
+      <filter type="log4net.Filter.LevelRangeFilter">
32
+        <param name="LevelMin" value="DEBUG" />
33
+        <param name="LevelMax" value="FATAL" />
34
+      </filter>
35
+    </appender>
36
+    <!--定义输出到 windows 事件中-->
37
+    <appender name="EventLogAppender" type="log4net.Appender.EventLogAppender">
38
+      <layout type="log4net.Layout.PatternLayout">
39
+        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline"></conversionPattern>
40
+      </layout>
41
+    </appender>
42
+  </log4net>
43
+</configuration>

+ 1 - 0
web/YTSoft.BaseCallCenter.MVCWeb/packages.config

@@ -7,6 +7,7 @@
7 7
   <package id="Hangfire.SqlServer" version="1.7.17" targetFramework="net45" />
8 8
   <package id="ICSharpCode.SharpZipLib.dll" version="0.85.4.369" targetFramework="net45" />
9 9
   <package id="jQuery" version="1.10.2" targetFramework="net45" />
10
+  <package id="log4net" version="2.0.12" targetFramework="net45" />
10 11
   <package id="Microsoft.AspNet.Mvc" version="5.0.0" targetFramework="net45" />
11 12
   <package id="Microsoft.AspNet.Mvc.FixedDisplayModes" version="5.0.0" targetFramework="net45" />
12 13
   <package id="Microsoft.AspNet.Mvc.zh-Hans" version="5.0.0" targetFramework="net45" />