Everyone is using log4net, but this is packaged well, sometimes we can not find the reason to think of whether it happened in the inside, for example, the configuration of logging to the database (Mysql, Oracle, SQL Server), etc., but is not recorded, and cannot find the reason, Just want to be log4net can follow up, here we may use log4net source code, but also to the source code in the more troublesome, in fact, do not, open log4net internal debugging good, can also record to a file convenient for us to find the reason:
Add the name "Log4net" to the appsettings node. Internal.debug ", and ensure that the value is" true "
<configuration> <appSettings> <add key="log4net. Internal.debug" value="true"/> </appSettings> </configuration>
confirm permission to read and write files
<system.diagnostics> <trace autoflush= true > <listeners> <add name = textwritertrace Listener type =
"
system.diagnostics.textwritertracelistener initializedata =" Span style= "color: #800000;" >c:\tmp\log4net.txt /> </listeners> </trace > </system.diagnostics>
You can then view the system log in "C:\tmp\log4net.txt" to find the cause of the problem.
Note: initializedata= "C:\tmp\log4net.txt" should not be placed on the C-drive, may not have permission
Log4net Open Internal Commissioning