[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]
Step 5 : add New Console project for POC (LoggingExample) and add 2 config files . app.config and log4net.config
appconfig; put the configuration and modified it for the databse connection string
log4net.config:put the configuration
You are almost done for POC . Just two Steps Remening
Step: 6 . Create Table in Database
DROP TABLE [dbo].[ApplicationLog] CREATE TABLE [dbo].[ApplicationLog] ( [Id] int IDENTITY (1, 1) NOT NULL, [Date] datetime NOT NULL, [Thread] varchar(255) NULL, [Level] varchar(50) NOT NULL, [Logger] varchar(255) NOT NULL, [Host] varchar(50) NOT NULL, [Message] varchar(4000) NOT NULL, [Exception] varchar(2000) NULL, [severity] varchar(255) NULL, [useranme] varchar(255) NULL, [applicationName] varchar(255) NULL )Step:7 In Console application
using System;
using Database;
namespace LoggingExample
{
class Program
{
static void Main(string[] args)
{
ILogger logger = new Logger();
logger.EnterMethod("Main");
logger.LogInfoMessage("LogInfo");
logger.LogError("ErrorLog");
logger.LeaveMethod("Main");
}
}
}
You are done now !! if you like it please put a comment.Hope this will help you :)