Note that there are some explanatory texts on larger screens.

plurals
  1. POLog4Net in MVC3 website only logs to SQL Database after stopping site
    primarykey
    data
    text
    <p>I've got a MVC3 website that I've just started. I'd like to add logging to this site, and decided to go with Log4Net. I used this <a href="http://basquang.wordpress.com/2011/08/26/logging-using-log4net-in-asp-net-mvc-3/" rel="nofollow">tutorial</a> for setting this up, and it works somewhat, but it isn't working as I expected.</p> <p>I set up my logging per the instructions found on the site I was using for instructions. I ran the site using the debugger and it should have logged a record when the Index action on the Home controller was called. </p> <p>I checked the table and it was empty. I stopped the debugger and checked my config file. Everything looked OK. I then put a break point on the line of code where the logging was done. The code was hit, but still nothing in my log table.</p> <p>I decided to turn on the log4net debugging. I modified my web.config and started the debugger again. Now when I checked my table, it showed two entries, but I noticed the time stamp was a few minutes old.</p> <p>After additional testing, I found the logger was only flushing to my table when I modified the web.config file.</p> <p>First of all, is this normal behavior?</p> <p>If not, is there a way to get log4net to log without me stopping my website?</p> <p>Thanks</p> <p><strong>Update with solution</strong></p> <p>Once the answer was provided by @tawman, I could then search on BufferSize. This was the reason for the problem I encountered. </p> <p>BufferSize is the number of Logs that will be queued before any are written. I changed this value to 1 (as opposed to the 100 suggested - The default is 500). </p> <p>This has my logs writing immediately. I don't know if there are any performance implications with a setting of 1, but I will have to look into this. </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.
    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