提交 | 用户 | 时间
|
e46d3b
|
1 |
using System; |
懒 |
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
[assembly: log4net.Config.XmlConfigurator(Watch = true)] |
|
7 |
namespace YX |
|
8 |
{ |
|
9 |
|
|
10 |
public class LogHelper |
|
11 |
{ |
|
12 |
/// <summary> |
|
13 |
/// 输出日志到Log4Net |
|
14 |
/// </summary> |
|
15 |
/// <param name="t"></param> |
|
16 |
/// <param name="ex"></param> |
|
17 |
#region static void WriteLog(Type t, Exception ex) |
|
18 |
|
|
19 |
public static void WriteLog(Type t, Exception ex) |
|
20 |
{ |
|
21 |
log4net.ILog log = log4net.LogManager.GetLogger(t); |
|
22 |
log.Error("Error", ex); |
|
23 |
} |
|
24 |
|
|
25 |
#endregion |
|
26 |
|
|
27 |
/// <summary> |
|
28 |
/// 输出日志到Log4Net |
|
29 |
/// </summary> |
|
30 |
/// <param name="t"></param> |
|
31 |
/// <param name="msg"></param> |
|
32 |
#region static void WriteLog(Type t, string msg) |
|
33 |
|
|
34 |
public static void WriteLog(Type t, string msg) |
|
35 |
{ |
|
36 |
log4net.ILog log = log4net.LogManager.GetLogger(t); |
|
37 |
log.Error(msg); |
|
38 |
} |
|
39 |
|
|
40 |
#endregion |
|
41 |
|
|
42 |
|
|
43 |
} |
|
44 |
} |