Note that there are some explanatory texts on larger screens.

plurals
  1. POlog4Net log file not writing
    primarykey
    data
    text
    <p>I am trying to implement log4net in my asp.net web application. But unfortunately the file is not created. Below is my configuration. </p> <p>1 . Added log4net .dll reference</p> <p>2 . Web.config settings. </p> <pre class="lang-xml prettyprint-override"><code> &lt;configSections&gt; &lt;section name="log4net"type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/&gt; &lt;/configSections&gt; &lt;log4net&gt; &lt;appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"&gt; &lt;file type="log4net.Util.PatternString" value="E:/Log/error_%date{dd-MM-yyyy}.log"/&gt; &lt;appendToFile value="true"/&gt; &lt;rollingStyle value="Date"/&gt; &lt;!--&lt;maxSizeRollBackups value="5"/&gt; &lt;maximumFileSize value="10MB"/&gt; &lt;staticLogFileName value="true"/&gt;--&gt; &lt;datePattern value="yyyyMMdd" /&gt; &lt;layout type="log4net.Layout.PatternLayout"&gt; &lt;conversionPattern value="%date [%thread] %level %logger - %message%newline%exception%newline%newline"/&gt; &lt;/layout&gt; &lt;/appender&gt; &lt;root&gt; &lt;appender-ref ref="RollingFileAppender"/&gt; &lt;/root&gt; &lt;/log4net&gt; </code></pre> <p>3 . Added Assembly reference</p> <pre><code> [assembly: log4net.Config.XmlConfigurator(Watch = true)] </code></pre> <p>4 . Log writing in the code behind</p> <pre><code>private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); try { throw new System.IO.FileNotFoundException(); } catch (Exception ex) { log.Error("Error error logging", ex); } </code></pre> <p>These are the steps I had followed, but the log is not created...</p> <p>Please give your suggestions.</p> <p>Thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload