1、在appSettings节点中增加名称为“log4net.Internal.Debug”的节点,并确保值为“true"
1 <configuration> 2 <appSettings> 3 <add key="log4net.Internal.Debug" value="true"/> 4 </appSettings> 5 </configuration>
2、设置文件路径,确认有读写文件的权限
1 <system.diagnostics> 2 <trace autoflush="true"> 3 <listeners> 4 <add 5 name="textWriterTraceListener" 6 type="System.Diagnostics.TextWriterTraceListener" 7 initializeData="C:\tmp\log4net.txt" /> 8 </listeners> 9 </trace> 10 </system.diagnostics>