<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>tewari &#187; log4net</title>
	<atom:link href="http://www.tewari.info/category/log4net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tewari.info</link>
	<description>Professional Software Development by Ash Tewari</description>
	<lastBuildDate>Thu, 03 Jun 2010 01:52:16 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Customize log4net Output Path</title>
		<link>http://www.tewari.info/2008/03/06/customize-log4net-output-path/</link>
		<comments>http://www.tewari.info/2008/03/06/customize-log4net-output-path/#comments</comments>
		<pubDate>Fri, 07 Mar 2008 00:56:55 +0000</pubDate>
		<dc:creator>tewari</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[log4net]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[output path]]></category>
		<category><![CDATA[RollingFileAppender]]></category>
		<category><![CDATA[startup directory]]></category>

		<guid isPermaLink="false">http://www.tewari.info/2008/03/06/customize-log4net-output-path/</guid>
		<description><![CDATA[	 The default log4net output path is relative to the startup directory of your executable. To customize the output path, you can override the base Appender&#8217;s File property in your own Appender class. The following example describes how to route the log files relative to the temp folder :
	
   public class MyOwnAppender : [...]]]></description>
			<content:encoded><![CDATA[	<p> The default log4net output path is relative to the startup directory of your executable. To customize the output path, you can override the base Appender&#8217;s File property in your own Appender class. The following example describes how to route the log files relative to the temp folder :</p>
	<pre name="code" class="csharp">
   public class MyOwnAppender : log4net.Appender.RollingFileAppender
   {
         public override string File
         {
             get
             {
                 return base.File;
             }
	
            set
            {
                if (Path.IsPathRooted(value))
                {
                    base.File = value;
                }
                else
                {
                    base.File = Path.Combine(Path.GetTempPath(), value);
                }
            }
        }
    }
</pre>
	<p>Your log4net config file must be modified so that log4net can locate and use your custom Appender. If MyOwnAppender is in MyNamespace and you have implemented it in MyLoggerLib.dll :</p>
	<pre name="code" class="xml">
<appender name=\"myFileAppender\" type=\"MyNamespace.MyOwnAppender, MyLoggerLib\">
</pre>
<hr/>Copyright &copy; 2010 <strong><a href="http://www.tewari.info">tewari</a></strong>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please contact legal@tewari.info so we can take legal action immediately.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">Plugin</a> by <a href="http://www.taragana.com/">Taragana</a></span>
</p>
<p class="akst_link"><a href="http://www.tewari.info/?p=30&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_30" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://www.tewari.info/2008/03/06/customize-log4net-output-path/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
