Jacqui1811
Programmer
Hi there.
I have used log4net many times before with success but am having problems getting it to log in this one web site.
I have [assembly: log4net.Config.XmlConfigurator(Watch = true)] in my AssemblyInfo.cs
Here is the code in the page at the top is.
private static readonly ILog log = LogManager.GetLogger(typeof(_edit));
and log.Error("Log Deleted 1"); is further down when I am trying to use it.
Here is my web.config section relevant.
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler"/>
</configSections>
<log4net debug="true">
<appender name="LogFileAppender" type="log4net.Appender.FileAppender,log4net">
<param name="File" value="C:/temp/test-web-log.txt"/>
<param name="AppendToFile" value="true"/>
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n"/>
</layout>
</appender>
<root>
<priority value="ALL"/>
<appender-ref ref="LogFileAppender"/>
</root>
</log4net>
I even have internal debugging on :
<add key="log4net.Internal.Debug" value="true"/>
<system.diagnostics>
<trace autoflush="true">
<listeners>
<add
name="textWriterTraceListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="C:\\temp\\log4net.txt" />
</listeners>
</trace>
</system.diagnostics>
Which seems to work but nothing of any help has been written to the file. Although it has created and written a few lines to it.
I have permissions on the directory set to everyone full control so don't think it can be permissions and we have written the debug file to the same directory.
Would be grateful for any help on this please
Thanks.
Jacqui.
I have used log4net many times before with success but am having problems getting it to log in this one web site.
I have [assembly: log4net.Config.XmlConfigurator(Watch = true)] in my AssemblyInfo.cs
Here is the code in the page at the top is.
private static readonly ILog log = LogManager.GetLogger(typeof(_edit));
and log.Error("Log Deleted 1"); is further down when I am trying to use it.
Here is my web.config section relevant.
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler"/>
</configSections>
<log4net debug="true">
<appender name="LogFileAppender" type="log4net.Appender.FileAppender,log4net">
<param name="File" value="C:/temp/test-web-log.txt"/>
<param name="AppendToFile" value="true"/>
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n"/>
</layout>
</appender>
<root>
<priority value="ALL"/>
<appender-ref ref="LogFileAppender"/>
</root>
</log4net>
I even have internal debugging on :
<add key="log4net.Internal.Debug" value="true"/>
<system.diagnostics>
<trace autoflush="true">
<listeners>
<add
name="textWriterTraceListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="C:\\temp\\log4net.txt" />
</listeners>
</trace>
</system.diagnostics>
Which seems to work but nothing of any help has been written to the file. Although it has created and written a few lines to it.
I have permissions on the directory set to everyone full control so don't think it can be permissions and we have written the debug file to the same directory.
Would be grateful for any help on this please
Thanks.
Jacqui.