<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Filename in log4net' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Filename in log4net' posted on the 'VB.NET' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2012 Programmers Heaven</copyright>
    <pubDate>Thu, 09 Feb 2012 07:28:40 -0800</pubDate>
    <lastBuildDate>Thu, 09 Feb 2012 07:28:40 -0800</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Filename in log4net</title>
      <link>http://www.programmersheaven.com/mb/VBNET/409844/409844/filename-in-log4net/</link>
      <description>&lt;br /&gt;
Hi All,&lt;br /&gt;
i am doing a VB.NET windows application. In that i am using Log4Net for logging details. I am new to using Log4Net. The problem i am facing is i want to create the logfiles with same name each day. means today if a log file is created with name debug.log, tomorrow also it should create a new log file with same name with out any change in the previous file name. how can i do this ? My appender configuration looks like this ..&lt;br /&gt;
&lt;br /&gt;
&amp;lt;appender name="RSLogFileAppenderDebug" type="log4net.Appender.RollingFileAppender"&amp;gt;&lt;br /&gt;
      &amp;lt;file value="C:\Log4NetExamples\debug.log" /&amp;gt;&lt;br /&gt;
      &amp;lt;appendToFile value="true" /&amp;gt;&lt;br /&gt;
      &amp;lt;rollingStyle value="Date" /&amp;gt;&lt;br /&gt;
      &amp;lt;filter type="log4net.Filter.LevelRangeFilter"&amp;gt;&lt;br /&gt;
          &amp;lt;acceptOnMatch value="true" /&amp;gt;&lt;br /&gt;
          &amp;lt;levelMin value="DEBUG" /&amp;gt;&lt;br /&gt;
          &amp;lt;levelMax value="FATAL" /&amp;gt;        &lt;br /&gt;
      &amp;lt;/filter&amp;gt;&lt;br /&gt;
      &amp;lt;maxSizeRollBackups value="1" /&amp;gt;&lt;br /&gt;
      &amp;lt;maximumFileSize value="10MB" /&amp;gt;&lt;br /&gt;
      &amp;lt;staticLogFileName value="true" /&amp;gt;&lt;br /&gt;
      &amp;lt;lockingModel type="log4net.Appender.FileAppender+MinimalLock" /&amp;gt;&lt;br /&gt;
      &amp;lt;layout type="log4net.Layout.PatternLayout"&amp;gt;&lt;br /&gt;
          &amp;lt;conversionPattern value="%newline%date [%thread] %-5level - %message" /&amp;gt;        &lt;br /&gt;
      &amp;lt;/layout&amp;gt;     &lt;br /&gt;
    &amp;lt;/appender&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;appender name="RSLogFileAppenderFatal" type="log4net.Appender.RollingFileAppender"&amp;gt;&lt;br /&gt;
      &amp;lt;file value="C:\Log4NetExamples\Fatal.log" /&amp;gt;&lt;br /&gt;
      &amp;lt;appendToFile value="true" /&amp;gt;&lt;br /&gt;
      &amp;lt;rollingStyle value="Date" /&amp;gt;&lt;br /&gt;
      &amp;lt;filter type="log4net.Filter.LevelRangeFilter"&amp;gt;&lt;br /&gt;
        &amp;lt;acceptOnMatch value="true" /&amp;gt;&lt;br /&gt;
        &amp;lt;levelMin value="FATAL" /&amp;gt;&lt;br /&gt;
        &amp;lt;levelMax value="FATAL" /&amp;gt;&lt;br /&gt;
      &amp;lt;/filter&amp;gt;&lt;br /&gt;
      &amp;lt;maxSizeRollBackups value="1" /&amp;gt;&lt;br /&gt;
      &amp;lt;maximumFileSize value="10MB" /&amp;gt;&lt;br /&gt;
      &amp;lt;staticLogFileName value="true" /&amp;gt;&lt;br /&gt;
      &amp;lt;lockingModel type="log4net.Appender.FileAppender+MinimalLock" /&amp;gt;&lt;br /&gt;
      &amp;lt;layout type="log4net.Layout.PatternLayout"&amp;gt;&lt;br /&gt;
        &amp;lt;conversionPattern value="%newline%date [%thread] %-5level - %message" /&amp;gt;&lt;br /&gt;
      &amp;lt;/layout&amp;gt;&lt;br /&gt;
    &amp;lt;/appender&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;root&amp;gt;&lt;br /&gt;
      &amp;lt;level value="ALL" /&amp;gt;&lt;br /&gt;
      &amp;lt;appender-ref ref="RSLogFileAppenderDebug" /&amp;gt;&lt;br /&gt;
      &amp;lt;appender-ref ref="RSLogFileAppenderFatal" /&amp;gt;      &lt;br /&gt;
    &amp;lt;/root&amp;gt;&lt;br /&gt;
&lt;br /&gt;
How can i do this ?? do i need to make any change in the appender config ? can anybody help?&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/VBNET/409844/409844/filename-in-log4net/</guid>
      <pubDate>Wed, 25 Nov 2009 04:43:06 -0800</pubDate>
      <category>VB.NET</category>
    </item>
    <item>
      <title>Re: Filename in log4net</title>
      <link>http://www.programmersheaven.com/mb/VBNET/409844/410131/re-filename-in-log4net/#410131</link>
      <description>I don't know anything about the software you are using... I did how ever read a few things just now and here is a suggestion (don't know if this will help or not)...&lt;br /&gt;
&lt;br /&gt;
Based on what I read (here: &lt;a href="http://logging.apache.org/log4net/release/config-examples.html)"&gt;http://logging.apache.org/log4net/release/config-examples.html)&lt;/a&gt; you should be able to specify Environment Variables in the filename of the Log File... There is NO WAY to have 2 files with the SAME NAME in the SAME LOCATION, so if you want to have a new file each day, you have to create a file with a new name... Based on what I read on Logging.apache.org, you should be able to specify a dynamic filename, but how this acts I couldn't tell you since I have never used this before...&lt;br /&gt;
&lt;br /&gt;
here goes:&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
'First you want to set the Enviroment Variable when you load your software
System.Environment.SetEnvironmentVariable("log4net
File", "log-" &amp;amp; Format(Now.ToString, "MM-dd-yyyy") &amp;amp; ".txt")
&lt;pre class="sourcecode"&gt;

Now that your environment var is set, you can use that $(log4netFile) environment variable in the FileName of the log4net settings in app.config.

Hope this atleast gets you moving down a path towards solving your question&lt;/pre&gt;&lt;/pre&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/VBNET/409844/410131/re-filename-in-log4net/#410131</guid>
      <pubDate>Tue, 01 Dec 2009 08:41:07 -0800</pubDate>
      <category>VB.NET</category>
    </item>
    <item>
      <title>Re: Filename in log4net</title>
      <link>http://www.programmersheaven.com/mb/VBNET/409844/421411/re-filename-in-log4net/#421411</link>
      <description>I know its a pretty dead thread... but I suspect the issue is from using &amp;lt;appender name="RSLogFileAppenderDebug" type="log4net.Appender.RollingFileAppender"&amp;gt;&lt;br /&gt;
when you want to be using &lt;br /&gt;
&lt;br /&gt;
&amp;lt;appender name="RSLogFileAppenderDebug" type="log4net.Appender.LogFileAppender"&amp;gt;&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/VBNET/409844/421411/re-filename-in-log4net/#421411</guid>
      <pubDate>Tue, 01 Feb 2011 15:16:08 -0800</pubDate>
      <category>VB.NET</category>
    </item>
  </channel>
</rss>
