1)
Add This in AssemblyInfo
Add This in AssemblyInfo
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Web.config", Watch = true)]
2)
Add This in web.Config
Add This in web.Config
Add This Under </sectionGroup> / After --> Reference
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
Add This Under </ configSections> / After --> Reference
<log4net debug="true">
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="LogFile\\Log.txt"/>
<appendToFile value="true"/>
<rollingStyle value="Size"/>
<maxSizeRollBackups value="10"/>
<maximumFileSize value="2KB"/>
<staticLogFileName value="true"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n"/>
</layout>
</appender>
<root>
<level value="DEBUG"/>
<appender-ref ref="RollingLogFileAppender"/>
</root>
</log4net>
3)
Create one folder Called LogFile
4) Add this Page where you want to catch the Log
Create one folder Called LogFile
4) Add this Page where you want to catch the Log
private static readonly log4net.ILog Log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
5)
Use log4net dll
Use log4net dll
No comments:
Post a Comment