Log4net not inserting into the database?

后端 未结 4 937
青春惊慌失措
青春惊慌失措 2020-12-30 01:20

I have log4net setup and configured to insert into a sql server 2005 table. My table is called Log. When I call the log4net method it does not enter any data into the log da

相关标签:
4条回答
  • 2020-12-30 01:43

    I don't really have any insight to your problem just by looking at your configuration, but you might try adding this to your app settings to see if log4net can tell you what is going wrong:

    <appSettings>         
      <add key="log4net.Internal.Debug" value="true"/> 
    </appSettings> 
    

    See the section titled "How do I enable log4net internal debugging?" for a description of how to capture log4net's internal logging.

    0 讨论(0)
  • 2020-12-30 01:45

    I had the same problem. In my case, I had to remove the use of [Exception] and @exception from the insert.

    So, I had to change my logging too. I basically had to create a nice dump of my exception and pass that into the message parameter.

    I hope this helps

    0 讨论(0)
  • 2020-12-30 01:50

    Unless you specifically set a user in your connection string Log4Net will attempt to log with whatever user account is assigned to the process (ASP.NET worker process if that is the case). Log4Net also will not throw exceptions if you it is unable to log. You can turn on debugging to see what the issue is.

    0 讨论(0)
  • 2020-12-30 02:04
    <bufferSize value="100" />
    

    It is saying that it will keep 100 logs in memory until written into DB. Maybe that's why you don't see anything in DB?

    0 讨论(0)
提交回复
热议问题