using System;
|
using System.Collections.Generic;
|
using System.IO;
|
using System.Linq;
|
using System.Web;
|
|
namespace JiangSu.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, "Resources\\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
|
{
|
}
|
}
|
}
|
}
|