Log4net waits until the application utility processes before entering the mssql2008 database

I am configuring log4net with:

[assembly: log4net.Config.XmlConfigurator(ConfigFile = "../ProjectName/Log4Net.config", Watch = true)]

I have 2 applications configured: 1. AdoNetAppender is registered in the log table in the mssql2008 database. 2. FileAppender, which looks something like this:

<appender name="FileAppender" type="log4net.Appender.FileAppender">
  <file value="c:\log-file.txt" />
  <appendToFile value="true" />
  <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
  </layout>
</appender>

The problem is that when an action is logged, it immediately appears in the log-file.txt file. It does not appear as an entry in the database until I do iisreset, recompile the web code, or process the application pool.

The configuration seems to be correct, as the action is ultimately recorded in the database. I just don't understand why the delay.

Can someone give me a reason or tell me how to fix this?

+5
source share
1

AdoNetAppender - . , , 1:

<bufferSize value="1" />
+8

All Articles