管道基础大数据平台系统开发-【CS】-ExportMap
13693261870
2023-09-07 093df84b78ebbf020fcb4f752b900925aac07565
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
 
namespace MoonExp.cs
{
    /// <summary>
    /// 日志输出类
    /// </summary>
    public class LogOut
    {
        /// <summary>
        /// 日志
        /// </summary>
        protected static readonly log4net.ILog _log;
 
        /// <summary>
        /// 静态构造函数
        /// </summary>
        static LogOut()
        {
            try
            {
                _log = log4net.LogManager.GetLogger("log4net");
 
                //HttpContext.Current.Request.PhysicalApplicationPath
                string fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Sources\\Log.config");
 
                log4net.Config.XmlConfigurator.Configure(new FileInfo(fileName));
            }
            catch
            {
            }
        }
 
        /// <summary>
        /// 调试
        /// </summary>
        /// <param name="message">日志</param>
        public static void Debug(string message)
        {
            try
            {
                if (_log.IsDebugEnabled)
                {
                    _log.Debug("调试:" + message + "\r\n\r\n");
                }
            }
            catch
            {
            }
        }
 
        /// <summary>
        /// 信息
        /// </summary>
        /// <param name="message">日志</param>
        public static void Info(string message)
        {
            try
            {
                if (_log.IsInfoEnabled)
                {
                    _log.Info("信息:" + message + "\r\n\r\n");
                }
            }
            catch
            {
            }
        }
 
        /// <summary>
        /// 警告
        /// </summary>
        /// <param name="message">日志</param>
        public static void Warn(string message)
        {
            try
            {
                if (_log.IsWarnEnabled)
                {
                    _log.Warn("警告:" + message + "\r\n\r\n");
                }
            }
            catch
            {
            }
        }
 
        /// <summary>
        /// 错误
        /// </summary>
        /// <param name="message">日志</param>
        public static void Error(string message)
        {
            try
            {
                if (_log.IsErrorEnabled)
                {
                    _log.Error("错误:" + message + "\r\n\r\n");
                }
            }
            catch
            {
            }
        }
 
        /// <summary>
        /// 致命
        /// </summary>
        /// <param name="message">日志</param>
        public static void Fatal(string message)
        {
            try
            {
                if (_log.IsFatalEnabled)
                {
                    _log.Fatal("致命:" + message + "\r\n\r\n");
                }
            }
            catch
            {
            }
        }
    }
}