c# - How I can set log4net to log my files into different folders each day? -


  1. 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?
  2. 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]&#13;&#10;" />     <footer value="[footer]&#13;&#10;" />     <conversionpattern value="%date [%thread] %-5level %logger [%ndc] &lt;%property{auth}&gt; - %message%newline" />   </layout> </appender> 

it create logfile named 'logs\2010\04\02.inf.log' (let date 2010-04-02)


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -