Click here to Skip to main content
15,936,602 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am unable to find the reason why log4net is not writing anything to log file. the below is the configuration I have used.
C#
<log4net debug="true">
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
	<file value="Log/TestLog.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>

But the same is working fine when i gives the path like this ..
C#
<file value="C:\\TestProj\\TestLog.txt" />

Can anyone help me on this?
Posted
Updated 1-Apr-19 2:08am
Comments
Fredrik Bornander 3-Apr-12 4:58am    
That works for me. Where are you looking for the log file?
Sebastian T Xavier 3-Apr-12 6:53am    
Didn't had write permission for IIS_IUSR... solved now.,
SubmarineX 12-May-14 7:29am    
How to get write permission?

Check if your application has write permissions on destination folder for log file.
 
Share this answer
 
Comments
Sebastian T Xavier 3-Apr-12 6:52am    
Solved this... didn't had write permission...
XML
<pre lang="text">
 void Application_Start(object sender, EventArgs e)
    {
        // Code that runs on application startup
        log4net.Config.XmlConfigurator.Configure();
    }
</pre>

initialization the connfig file
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900