Reputation: 71
I have made changes into my Web.Config
I am using .net 4.0
I am using log4net i have added the reference
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<log4net debug="true">
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="C:\Users\n.gupta\Desktop\CacheService.log"/>
<appenToFile value="true" />
<rollingStyle value="Size"/>
<maxsixeRollBackups value="10"/>
<maximumFileSize value="10Mb"/>
<staticLogFileName value="true"/>
<layout type="log4net.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>
I have made changes in AssemblyInfo.cs
[assembly:log4net.Config.XmlConfigurator(ConfigFile="Web.config",Watch=true)]
I have add the debugging into my controller
I have a shipment controller which contains a creating method in whihc i am logging
public class ShipmentController : BaseController
{
private static readonly ILog logger = ogManager.GetLogger(typeof(ShipmentController));
public ActionResult ShipmentCreation()
{
//I have attached the debug code for the message
logger.Debug("Hello I am in Shipment creation Method");
}
}
The file being created but it in not appending anything
Upvotes: 2
Views: 70
Reputation: 1730
You have at least two syntax errors in your config's XML:
<appenToFile value="true" />
<rollingStyle value="Size"/>
<maxsixeRollBackups value="10"/>
appendToFile
and maxSize...
at the very least, must be corrected.
Upvotes: 1