using System;
|
using System.Collections.Generic;
|
using System.IO;
|
using System.Linq;
|
using System.Text;
|
|
namespace AsiaINFO.SMS.DBFactory
|
{
|
public class log4netService
|
{
|
static log4netService()
|
{
|
string path = AppDomain.CurrentDomain.BaseDirectory + "log4net.config";
|
log4net.Config.XmlConfigurator.Configure(new FileInfo(path));
|
}
|
|
public static log4net.ILog GetLog(string logName)
|
{
|
log4net.ILog log = log4net.LogManager.GetLogger(logName);
|
return log;
|
}
|
private static string DefaultLoggerName = "RollingFileLog";
|
public static void Debug(string message)
|
{
|
log4net.ILog log = log4net.LogManager.GetLogger(DefaultLoggerName);
|
if (log.IsDebugEnabled)
|
{
|
log.Debug(message);
|
}
|
log = null;
|
}
|
public static void Info(string message)
|
{
|
log4net.ILog log = log4net.LogManager.GetLogger(DefaultLoggerName);
|
if (log.IsInfoEnabled)
|
{
|
log.Info(message);
|
}
|
log = null;
|
}
|
public static void Error(string message)
|
{
|
log4net.ILog log = log4net.LogManager.GetLogger(DefaultLoggerName);
|
if (log.IsErrorEnabled)
|
{
|
log.Error(message);
|
}
|
log = null;
|
}
|
public static void Warm(string message)
|
{
|
log4net.ILog log = log4net.LogManager.GetLogger(DefaultLoggerName);
|
if (log.IsWarnEnabled)
|
{
|
log.Warn(message);
|
}
|
log = null;
|
}
|
}
|
}
|