1, [Assembly:log4net. Config.xmlconfigurator (configfile = "Web. config", Watch = true)] writes to AssemblyInfo.cs in the custom log class
<configSections> <!--Add log4net configuration section--<section name= "log4net" type= "log4net. Config.log4netconfigurationsectionhandler,log4net "/> </configSections> <!--settings log4net configuration section-- <log4net> <!--output to file--<appender name= "Rollingfile" type= "log4net. Appender.rollingfileappender,log4net "> <param name=" File "type=" "value=" C:\testlog\log.txt "/> <param name= "Appendtofile" value= "true"/> <param name= "Staticlogfilename" value= "true"/> <!--scrolling: By date-<param name= "Rollingstyle" value= "date"/> <param name= "Da Tepattern "value=" YyyyMMdd "/> <!--scrolling mode: By log size <param name=" Rollingstyle "value=" size "/> <param name= "maxsizerollbackups" value= "2MB/> <param name=" maximumfilesize "value="/& Gt --<layout type= "log4net. Layout.patternlayout,log4net "> <param name=" Header "value=" "/> <param name=" Foo ter "value=" "/> <param name=" Conversionpattern "value="%n%date [Thread Id:%thread] File:%file [%line]%-5le Vel%logger [priority:%PROPERTY{NDC}]----%n "error message"%m%n%n "/> </layout> </appender> <root> <level value= "All"/> <appender-ref ref= "Rollingfile"/> </root> </log4net>
log4net Web. config configuration