asp.net - log4net rolling file appender not working -
i have following configuration:
<log4net> <root> <level value="all"/> <appender-ref ref="rollingfileappender"/> </root> <appender name="rollingfileappender" type="log4net.appender.rollingfileappender"> <file value="mylog.log"/> <appendtofile value="true"/> <preservelogfilenameextension value="true"/> <rollingstyle value="composite"/> <datepattern value=".yyyymmdd"/> <maximumfilesize value="5mb"/> <countdirection value="1"/> <maxsizerollbackups value="-1"/> <staticlogfilename value="false"/> <layout type="log4net.layout.patternlayout"> <param name="conversionpattern" value="%date [%thread] %-5level %logger - %message%newline"/> </layout> </appender> </log4net>
and following code in global.asax:
sub application_start() arearegistration.registerallareas() registerglobalfilters(globalfilters.filters) registerroutes(routetable.routes) basicconfigurator.configure(); logmanager.getlogger(typeof(global_asax)).error("logger configured") end sub
for tag file in configuration above. have tried c:\my folder\mylog.log seen above mylog.log
however, not see file generated anywhere , there no exceptions.
environment: vs 2013 asp.net vb. running via debug menu. when run iisexpress started vs2013 , site runs. no log seen.
i have tried various combinations file tag nothing works.
can please?
this used work me (i've switched lighter , better configurable nlog), log rolled daily, written in subfolder named "logs" under app's path.
<appender name="rollingdebugappender" type="log4net.appender.rollingfileappender"> <file value="logs\" /> <datepattern value="yyyy-mm-dd'-full.log'" /> <staticlogfilename value="false" /> <appendtofile value="true" /> <rollingstyle value="composite" /> <maxsizerollbackups value="100" /> <maximumfilesize value="5mb" /> <layout type="log4net.layout.patternlayout"> <conversionpattern value="%date [%thread] %-5level %logger [%property{ndc}] - %message%newline" /> </layout> </appender>
Comments
Post a Comment