c# - How I can set log4net to log my files into different folders each day? -
- i want save logs during each day in folder named yyyymmdd - log4net should handle creating new folder depending on system datetime - how can setup this?
- i want save logs during day n files of 1mb - don't want rewrite old files have logs during 1 day - how can setup this?
i usin c#
regards alex
try (it should ok!):
<appender name="logfileappender" type="log4net.appender.rollingfileappender"> <file value="logs\\" /> <appendtofile value="true" /> <datepattern value="yyyy\\\\mm\\\\dd'.inf.log'" /> <rollingstyle value="date" /> <param name="staticlogfilename" value="false" /> <layout type="log4net.layout.patternlayout"> <header value="[header] " /> <footer value="[footer] " /> <conversionpattern value="%date [%thread] %-5level %logger [%ndc] <%property{auth}> - %message%newline" /> </layout> </appender>
it create logfile named 'logs\2010\04\02.inf.log' (let date 2010-04-02)
Comments
Post a Comment