建表
CREATE TABLE [dbo].[LogDetails] (
[LogID] int NOT NULL IDENTITY(1,1) ,
[LogDate] datetime NOT NULL ,
[LogThread] nvarchar(100) NOT NULL ,
[LogLevel] nvarchar(200) NOT NULL ,
[LogLogger] nvarchar(500) NOT NULL ,
[LogMessage] nvarchar(3000) NOT NULL ,
[LogActionClick] nvarchar(4000) NULL ,
[UserName] nvarchar(30) NULL ,
[UserIP] varchar(20) NULL
)
2.配置 Log4Net.config
C:\hlm\玻璃配方系统\log4net.config
3.AssemblyInfo.cs中天下下面内容
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log4Net.config", Watch = true)]
public class log
{
private static readonly log4net.ILog logtool = log4net.LogManager.GetLogger(typeof(log));
public static void info(LogContent ex)
{
logtool.Info(ex);
}
public static void warn(LogContent ex)
{
logtool.Warn(ex);
}
public static void fatal(LogContent ex)
{
logtool.Fatal(ex);
}
public static void error(LogContent ex)
{
logtool.Error(ex);
}
}