<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:blogChannel="http://backend.userland.com/blogChannelModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" version="2.0">
  <channel>
    <title>YapBee</title>
    <description>Yet Another Programer Blog by Hakkı Yılmaz</description>
    <link>http://www.yapbee.com/</link>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <generator>BlogEngine.NET 1.4.5.0</generator>
    <language>en-GB</language>
    <blogChannel:blogRoll>http://www.yapbee.com/opml.axd</blogChannel:blogRoll>
    <blogChannel:blink>http://www.dotnetblogengine.net/syndication.axd</blogChannel:blink>
    <dc:creator>Hakki Yilmaz</dc:creator>
    <dc:title>YapBee</dc:title>
    <geo:lat>0.000000</geo:lat>
    <geo:long>0.000000</geo:long>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Yapbee" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="yapbee" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
      <title>Integrating log4net with Enterprise Library Exception Handling Application Block</title>
      <description>&lt;p&gt;Most people may prefer Entlib Logging because Exception Handling Application Block (EHAP) which is another cool Entlib part serve integration with Logging as an inbox solution and another thing Entlib Logging has the ability of consuming WCF traces with a proxy trace listener.&lt;/p&gt;  &lt;p&gt;But if you don’t want to use Entlib Logging because of some performance issues and prefer using log4net or another tool there is a chance here provided. In this post I will show you how to integrate EHAP with log4net. Directing WCF traces to log4net is beyond this post I will provide it in the next posts.&lt;/p&gt;  &lt;p&gt;Now let’s start. EHAP providing us an interface IExceptionHandler and implementing this interface and declaring it in the configuration file you have your own way of handing exceptions. And Entlib configuration system needs this class decorated with ConfigurationElementType attribute like below.&lt;/p&gt;  &lt;p&gt;[ConfigurationElementType(typeof(CustomHandlerData))]&lt;/p&gt;  &lt;p&gt;This decoration lets Entlib configuration system pass parameters defined in configuration file to your class constructor as a NameValueCollection. IExceptionHandler interface has a single method HandleException that give you the chance to handle exception. At the end of the method you either return same exception or another one you provided.&lt;/p&gt;  &lt;p&gt;Here is my implementation. &lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; Microsoft.Practices.EnterpriseLibrary.Common.Configuration;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; Microsoft.Practices.EnterpriseLibrary.ExceptionHandling;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Specialized;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; log4net;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; log4net.Core;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; YapBee.Samples.log4netExceptionHandler&lt;/pre&gt;

  &lt;pre class="alt"&gt;{&lt;/pre&gt;

  &lt;pre&gt;    [ConfigurationElementType(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(CustomHandlerData))]&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; log4netExceptionHandler : IExceptionHandler&lt;/pre&gt;

  &lt;pre&gt;    {&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;readonly&lt;/span&gt; ILog log = LogManager.GetLogger(&lt;/pre&gt;

  &lt;pre&gt;            System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; log4netExceptionHandler(NameValueCollection configurationData)&lt;/pre&gt;

  &lt;pre class="alt"&gt;        {&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="kwrd"&gt;string&lt;/span&gt; categories = configurationData[&lt;span class="str"&gt;&amp;quot;logCategories&amp;quot;&lt;/span&gt;];&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (&lt;span class="kwrd"&gt;string&lt;/span&gt;.IsNullOrEmpty(categories))&lt;/pre&gt;

  &lt;pre&gt;                m_categories = &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt;[] { &lt;span class="str"&gt;&amp;quot;General&amp;quot;&lt;/span&gt; };&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;            {&lt;/pre&gt;

  &lt;pre class="alt"&gt;                m_categories = categories.Split(&lt;span class="str"&gt;','&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;            }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="kwrd"&gt;string&lt;/span&gt; levelString = configurationData[&lt;span class="str"&gt;&amp;quot;Level&amp;quot;&lt;/span&gt;];&lt;/pre&gt;

  &lt;pre class="alt"&gt;            level = log.Logger.Repository.LevelMap[levelString];&lt;/pre&gt;

  &lt;pre&gt;        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; Exception HandleException(Exception exception, Guid handlingInstanceId)&lt;/pre&gt;

  &lt;pre class="alt"&gt;        {&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (log.Logger.IsEnabledFor(level))&lt;/pre&gt;

  &lt;pre class="alt"&gt;            {&lt;/pre&gt;

  &lt;pre&gt;                LoggingEvent loggingEvent = &lt;span class="kwrd"&gt;new&lt;/span&gt; LoggingEvent(ThisDeclaringType,&lt;/pre&gt;

  &lt;pre class="alt"&gt;                    log.Logger.Repository, log.Logger.Name, level, exception.Message, exception);&lt;/pre&gt;

  &lt;pre&gt;                loggingEvent.Properties[&lt;span class="str"&gt;&amp;quot;Categories&amp;quot;&lt;/span&gt;] = m_categories;&lt;/pre&gt;

  &lt;pre class="alt"&gt;                log.Logger.Log(loggingEvent);&lt;/pre&gt;

  &lt;pre&gt;            }&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; exception;&lt;/pre&gt;

  &lt;pre&gt;        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt;[] m_categories;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; Level level;&lt;/pre&gt;

  &lt;pre&gt;&amp;#160;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;readonly&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; Type ThisDeclaringType = &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(log4netExceptionHandler);&lt;/pre&gt;

  &lt;pre&gt;    }&lt;/pre&gt;

  &lt;pre class="alt"&gt;}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;And here is the configuration&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;exceptionHandling&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;exceptionPolicies&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;WCF Exception Shielding&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;exceptionTypes&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;          &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;YapBee.Samples.WCFService1.MyInternalSampleException, YapBee.Samples.WCFService1&amp;quot;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="attr"&gt;postHandlingAction&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;ThrowNewException&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;MyInternalSampleException&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;exceptionHandlers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;              &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;logCategories&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;BusinessFault,UnauthorizedUserOperation&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Level&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Warn&amp;quot;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;                &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;YapBee.Samples.log4netExceptionHandler.log4netExceptionHandler, &lt;/pre&gt;

  &lt;pre&gt;                YapBee.Samples.log4netExceptionHandler&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Custom Handler&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;              &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;exceptionMessage&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;faultContractType&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;YapBee.Samples.WCFService1.ServiceFault,&lt;/pre&gt;

  &lt;pre&gt;                   YapBee.Samples.WCFService1&amp;quot;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;                  &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.WCF.FaultContractExceptionHandler, &lt;/pre&gt;

  &lt;pre&gt;                  Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.WCF, &lt;/pre&gt;

  &lt;pre class="alt"&gt;                  Version=4.0.0.0, Culture=neutral, PublicKeyToken=null&amp;quot;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;                  &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;DefaultFaultContract Handler&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;mappings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;                  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;source&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;{Guid}&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Id&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;                  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;source&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;{Message}&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;MessageText&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;                &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;mappings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;              &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;exceptionHandlers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;          &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;....&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;In my sample code I make use of WCF Exception Shielding Policy come with the EHAP so there is a section with the name. This means whenever an exception thrown in service its handled by EHAP.&amp;#160; And from the configuration part you can see there is declared an Exception which is a custom exception provided by me and there is two handlers for the exception type one is our log4netExceptionHandler and the other FaultContractExceptionHandler which is come with EHAP. These two handler handles exception consequently.&lt;/p&gt;

&lt;p&gt;As you can see from the exceptionHandlers section in xml there is a logCategories parameter and a Level parameter. The other name and type parameters are needed by configuration system in order to initiate handler class. logCategories and Level parameters are passed to constructor of custom handler class. And the constructor logic stores the values to the private fields in order to use in HandleException method later. Lastly in the HandleException method simply initiate a LoggingEvent and call Logger to log it.&lt;/p&gt;

&lt;p&gt;You can download sample code from &lt;a href="http://jl4qew.bay.livefilestore.com/y1pxr7LaYpVc_kK9X0XKfGP1zjoP4Bj-I4RSuIfL9Mf6JT_jgJDlqE1_-sP4e_HhNEvm1DYwU4Y7o1zj4OSPQt-eg/YapBee.Samples.zip?download" target="_blank"&gt;here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In zip two console applications provided one is wcf service with hosting app the other is client simply calling GetIPAddress and ThrowException methods. When ThrowException method called in wcf app debugger hangs it is not a bug don’t panic, simply press F5 to proceed. You will see exception string on client console and exception log on wcf service console.&lt;/p&gt;

&lt;p&gt;Users of log4net know that log4net doesn’t let you categorize logs like Entlib Logging. In discussions around on Entlib Logging or log4net which to prefer I see some says there isn’t categorization available in log4net unlike Entlib Logging and this is a significant functionality they want to see in a logging tool I notice. This is quite true but log4net’s categorization is provided with Levels and Named Loggers. I think there must be a fair requirement for this so I extended log4net for categorization support. &lt;/p&gt;

&lt;p&gt;I will provide categorized log4net in my next post. &lt;/p&gt;</description>
      <link>http://www.yapbee.com/post/2009/03/09/Integrating-log4net-with-Enterprise-Library-Exception-Handling-Application-Block.aspx</link>
      <author>info.nospam@nospam.yapbee.com (Hakkı Yılmaz)</author>
      <comments>http://www.yapbee.com/post/2009/03/09/Integrating-log4net-with-Enterprise-Library-Exception-Handling-Application-Block.aspx#comment</comments>
      <guid>http://www.yapbee.com/post.aspx?id=4c376df3-5983-4ced-bf37-b9c992275bb8</guid>
      <pubDate>Mon, 09 Mar 2009 00:21:52 +0000</pubDate>
      <category>Entlib</category>
      <category>Logging</category>
      <dc:publisher>Hakkı Yılmaz</dc:publisher>
      <pingback:server>http://www.yapbee.com/pingback.axd</pingback:server>
      <pingback:target>http://www.yapbee.com/post.aspx?id=4c376df3-5983-4ced-bf37-b9c992275bb8</pingback:target>
      <slash:comments>297</slash:comments>
      <trackback:ping>http://www.yapbee.com/trackback.axd?id=4c376df3-5983-4ced-bf37-b9c992275bb8</trackback:ping>
      <wfw:comment>http://www.yapbee.com/post/2009/03/09/Integrating-log4net-with-Enterprise-Library-Exception-Handling-Application-Block.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.yapbee.com/syndication.axd?post=4c376df3-5983-4ced-bf37-b9c992275bb8</wfw:commentRss>
    </item>
    <item>
      <title>Getting started with log4net</title>
      <description>&lt;p&gt;This post is a startup for using log4net in your application and briefly mentions on features, building blocks and extension points of log4net.&lt;/p&gt;  &lt;p&gt;For whom doesn’t hear log4net before, log4net is an open source project used by .net community for logging and is a port of log4j that is developed for Java World and can be downloaded &lt;a href="http://logging.apache.org/log4net/download.html" target="_blank"&gt;here&lt;/a&gt;under Apache License. &lt;/p&gt;  &lt;p&gt;Starting up with log4net is really simple process with provided samples come with the package. Let’s start step by step :&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;After downloading log4net package and unzipping it open a project in Visual Studio and add reference to log4net.dll. &lt;/li&gt;    &lt;li&gt;Add an Application Configuration File and copy paste the xml below. &lt;/li&gt;    &lt;li&gt;Go to application’s starting point (in my case Console Application’s Main method) and obtain a reference to an instance of Logger. &lt;/li&gt;    &lt;li&gt;Issue configuration request. &lt;/li&gt;    &lt;li&gt;End last feel free using your logger. &lt;/li&gt; &lt;/ol&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="html"&gt;xml&lt;/span&gt; &lt;span class="attr"&gt;version&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;1.0&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;encoding&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;utf-8&amp;quot;&lt;/span&gt; ?&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;configuration&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;configSections&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;section&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;log4net&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;log4net.Config.Log4NetConfigurationSectionHandler, log4net&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;configSections&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;log4net&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="rem"&gt;&amp;lt;!-- [Appenders]--&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;appender&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;ConsoleAppender&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;log4net.Appender.ConsoleAppender&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;layout&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;log4net.Layout.PatternLayout&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;conversionPattern&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;%date [%thread] %-5level %logger - %message%newline&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;layout&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;filter&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;log4net.Filter.LevelRangeFilter&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;levelMin&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;DEBUG&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;levelMax&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;INFO&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;filter&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;appender&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;appender&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;RollingFile&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;log4net.Appender.RollingFileAppender&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;file&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;example.log&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;appendToFile&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;maximumFileSize&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;100KB&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;maxSizeRollBackups&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;2&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;layout&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;log4net.Layout.PatternLayout&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;conversionPattern&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;%level %thread %logger - %message%newline&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;layout&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;appender&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="rem"&gt;&amp;lt;!-- [/Appenders]--&amp;gt;&lt;/span&gt;
    
    &lt;span class="rem"&gt;&amp;lt;!-- [Loggers]--&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;root&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;level&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;ALL&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;appender-ref&lt;/span&gt; &lt;span class="attr"&gt;ref&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;ConsoleAppender&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;root&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;logger&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;YapBee.Common&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;additivity&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;false&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;level&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;DEBUG&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;appender-ref&lt;/span&gt; &lt;span class="attr"&gt;ref&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;RollingFile&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;logger&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;logger&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;YapBee.Security&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;additivity&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;false&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;level&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;INFO&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;appender-ref&lt;/span&gt; &lt;span class="attr"&gt;ref&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;ConsoleAppender&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;appender-ref&lt;/span&gt; &lt;span class="attr"&gt;ref&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;RollingFile&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;logger&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;logger&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;YapBee.Business.Accounting&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;additivity&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;false&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;level&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;ALL&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;appender-ref&lt;/span&gt; &lt;span class="attr"&gt;ref&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;ConsoleAppender&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;logger&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="rem"&gt;&amp;lt;!-- [Loggers]--&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;log4net&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;configuration&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;










.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;













.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;style type="text/css"&gt;













.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;And here is my code&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Reflection;

&lt;span class="kwrd"&gt;using&lt;/span&gt; log4net;

&lt;span class="kwrd"&gt;namespace&lt;/span&gt; YapBee.Poc.Logging
{
    &lt;span class="kwrd"&gt;class&lt;/span&gt; Program
    {
        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;readonly&lt;/span&gt; ILog log = 
            LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
        &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)
        {
            log4net.Config.XmlConfigurator.Configure();

            log.Debug(&lt;span class="str"&gt;&amp;quot;log message 1&amp;quot;&lt;/span&gt;);
            ILog log2 = LogManager.GetLogger(&lt;span class="str"&gt;&amp;quot;YapBee.Business.Accounting&amp;quot;&lt;/span&gt;);
            log2.Info(&lt;span class="str"&gt;&amp;quot;log an Info&amp;quot;&lt;/span&gt;);
            log2.Error(&lt;span class="str"&gt;&amp;quot;log an error&amp;quot;&lt;/span&gt;); &lt;span class="rem"&gt;// This log will be filtered&lt;/span&gt;
            Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Press Enter to exit&amp;quot;&lt;/span&gt;);
            Console.ReadLine();
        }
    }
}&lt;/pre&gt;
&lt;style type="text/css"&gt;













.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;After this fast start up I want to step into features and building blocks of log4net. &lt;/p&gt;

&lt;p&gt;log4net is fully configurable programaticly and by using configuration files and provides you a simple interface for logging. log4net’s structure consists of four main components which are Logger, Repository, Appender and the Layout.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Logger&lt;/b&gt;, is the main component which your application interacts with to generate log messages. There is another class LoggerManager responsible for creation and management of instances of Logger. Logger instances are named entities and served in a hierarchal manner which means if there are Loggers one named &lt;b&gt;&lt;i&gt;a&lt;/i&gt;&lt;/b&gt; and another &lt;b&gt;&lt;i&gt;a.b&lt;/i&gt;&lt;/b&gt; (hierarchy supplied with a dot) then all properties of &lt;b&gt;&lt;i&gt;a&lt;/i&gt;&lt;/b&gt; is inherited by &lt;b&gt;&lt;i&gt;a.b&lt;/i&gt;&lt;/b&gt;. &lt;/p&gt;

&lt;p&gt;From the above config file you can see how named Loggers are configured. There is a root element which is still a Logger with the other logger blocks. All the other named Loggers are inherits their properties from this root logger unless they have an additivity attribute set to false. Additivity prevents the inheritance from the ancestor. You can notice that I gave loggers namespace like names and have %logger parameter at the layout. Similarly you may have each component have its own logger and this help you finding problems and vulnerabilities efficiently.&lt;/p&gt;

&lt;p&gt;You initiate Logger instances using LogManager.GetLogger method and supply it the name of the logger like this:&lt;/p&gt;

&lt;p&gt;log4net.ILog log = log4net.LogManager.GetLogger(&amp;quot;YapBee.Security&amp;quot;);&lt;/p&gt;

&lt;p&gt;Here in fact LogManager is an extension to LoggerManager class and wraps Logger instances into LogImpl instances which derived from ILog interface and in this way serve us methods which know their levels.&lt;/p&gt;

&lt;p&gt;So that we can log messages by using log.Debug or log.Info like methods which are not possible with the Logger.&lt;/p&gt;

&lt;p&gt;Logger have a priority level can be configured using &lt;b&gt;Level&lt;/b&gt; element and by using this you may filter log events and direct them to different output destinations. &lt;/p&gt;

&lt;p&gt;&lt;b&gt;Appender&lt;/b&gt;, is define the logging sink (output destination) and there is a number of Appender classes under log4net.Appender namespace that enable you to log to Console, Event Log, Database, Aspnet Trace, mail etc. You either use provided appenders or create custom appenders by extending log4net.Appender.AppenderSkeleton class or implementing &lt;code&gt;IAppender&lt;/code&gt; interface.&lt;/p&gt;

&lt;p&gt;As you can see from config using appender-ref element you attach Appenders (zero or more) to Logger.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Layout&lt;/b&gt;, is the formatter of the message. Like Appender Layout serve you another chance to extend the framework.&lt;/p&gt;

&lt;p&gt;There is another thing named &lt;b&gt;Filter&lt;/b&gt;. Filter as its name suggest it gives you opportunity to filter out messages. I will not go in deep on these classes, you may find more information about Appender, Layout, Filter at the official documentation.&lt;/p&gt;

&lt;p&gt;Possibly most of the users never need &lt;b&gt;Repository&lt;/b&gt;. By default all assemblies loaded by single process share same configuration file but repository let them have their own configuration. &lt;/p&gt;

&lt;p&gt;Log4net also supports writing plugins. &lt;/p&gt;

&lt;p&gt;I tried to make a summary on log4net. But It seems like summary of summary :)&lt;/p&gt;
&lt;style type="text/css"&gt;













.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;</description>
      <link>http://www.yapbee.com/post/2009/02/24/Getting-started-with-log4net.aspx</link>
      <author>info.nospam@nospam.yapbee.com (Hakkı Yılmaz)</author>
      <comments>http://www.yapbee.com/post/2009/02/24/Getting-started-with-log4net.aspx#comment</comments>
      <guid>http://www.yapbee.com/post.aspx?id=3ee4a320-bea4-4ef9-94cf-9f5aa1291a78</guid>
      <pubDate>Tue, 24 Feb 2009 21:19:00 +0000</pubDate>
      <category>Logging</category>
      <dc:publisher>Hakkı Yılmaz</dc:publisher>
      <pingback:server>http://www.yapbee.com/pingback.axd</pingback:server>
      <pingback:target>http://www.yapbee.com/post.aspx?id=3ee4a320-bea4-4ef9-94cf-9f5aa1291a78</pingback:target>
      <slash:comments>217</slash:comments>
      <trackback:ping>http://www.yapbee.com/trackback.axd?id=3ee4a320-bea4-4ef9-94cf-9f5aa1291a78</trackback:ping>
      <wfw:comment>http://www.yapbee.com/post/2009/02/24/Getting-started-with-log4net.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.yapbee.com/syndication.axd?post=3ee4a320-bea4-4ef9-94cf-9f5aa1291a78</wfw:commentRss>
    </item>
    <item>
      <title>log4net vs Enterprise Library Logging Application Block</title>
      <description>&lt;p&gt;
In past recent weeks I dealed with log4net and Enterprise Library
Logging Application Block in order to compare which one is most
appropriate tool for our enterprise application. So I wanted to share
my exprerience. This is the first post of a series about the logging
and constitutes priliminary for the issue. In this series you will find
what features are provided and and how this two meet your auditing
concerns of your application.
&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;
In the enterprise application&amp;#39;s world we have some core concerns
(business logic) and some
cross cutting concerns like logging, auditing, transaction management,
memory allocation, security etc. and from the OO Programmer point of
view we separate these concerns in order to serve a loosely coupled
architecture. And I will focus on logging which supporting our auditing
infrastructure.
&lt;/p&gt;
&lt;p&gt;
In order to select one of this cool tools first you must define your consideration and prioritize your expectations.
&lt;/p&gt;
&lt;p&gt;
Now let&amp;#39;s start. We are using WCF for our SOA architecture and other
Enterprise Library Application Blocks for exception handling,
validation. 
&lt;/p&gt;
&lt;p&gt;
And here is the criterias: 
&lt;/p&gt;
&lt;p&gt;
- Integration with other program concerns we use (WCF and Entib)
&lt;/p&gt;
&lt;p&gt;
- Outputing to several output media for example flat file, database, windows eventlog etc.
&lt;/p&gt;
&lt;p&gt;
- Configuration richness (configurability of every aspect)
&lt;/p&gt;
&lt;p&gt;
- Configuration simplicity
&lt;/p&gt;
&lt;p&gt;
- Extendability
&lt;/p&gt;
&lt;p&gt;
- Stability
&lt;/p&gt;
&lt;p&gt;
- Performance
&lt;/p&gt;
&lt;p&gt;
- Documentation &amp;amp; Support
&lt;/p&gt;
&lt;p&gt;
I made simple PoC applications for both for examining features and read
blog posts, refered to official documentations, downloaded samples and
these made me think both have sufficient examples and documentation and
configuration richness. Through playing with provided samples I saw
both have a sufficient level of extendibility options. But with the in
box configuration tool Enterprise Library Logging has a minor advantage
of configuration simplicity. There are plenty of written article upon
Entlib logging on the web and there is an active community using it and
this made me have the idea with the EntLib logging getting help with it
will be much more easier. When we come to the stability I didn&amp;#39;t see
users struggling with the problems they faced around. Its enough for me
now about stability of them.
&lt;/p&gt;
&lt;p&gt;
When we come to the performance which too many people discussing on
the issue. I tested them with 100.000 records with console output
option and log4net was four times faster than Entlib logging and with
the database output option&amp;nbsp;log4net faster again. log4net is the winner
of the test drive by means of performance. But I think this test drive
does not show using that Entlib logging will boast your application
performance. I think no one will log 100.000 log entry in a sequential
manner. 
&lt;/p&gt;
&lt;p&gt;
Last point perhaps one of the most important is the integration. Entlib
logging serve us good integration points with other application blocks
and WCF.
&lt;/p&gt;
&lt;p&gt;
Much of you will say this all blah blah. Be patient, soon I will come up with sample codes and howtos. 
&lt;/p&gt;
</description>
      <link>http://www.yapbee.com/post/2009/02/19/log4net-vs-Enterprise-Library-Logging-Application-Block.aspx</link>
      <author>info.nospam@nospam.yapbee.com (Hakkı Yılmaz)</author>
      <comments>http://www.yapbee.com/post/2009/02/19/log4net-vs-Enterprise-Library-Logging-Application-Block.aspx#comment</comments>
      <guid>http://www.yapbee.com/post.aspx?id=5152f217-1def-4c53-8c27-66fb6b788065</guid>
      <pubDate>Thu, 19 Feb 2009 12:59:00 +0000</pubDate>
      <category>Entlib</category>
      <category>Logging</category>
      <dc:publisher>Hakkı Yılmaz</dc:publisher>
      <pingback:server>http://www.yapbee.com/pingback.axd</pingback:server>
      <pingback:target>http://www.yapbee.com/post.aspx?id=5152f217-1def-4c53-8c27-66fb6b788065</pingback:target>
      <slash:comments>270</slash:comments>
      <trackback:ping>http://www.yapbee.com/trackback.axd?id=5152f217-1def-4c53-8c27-66fb6b788065</trackback:ping>
      <wfw:comment>http://www.yapbee.com/post/2009/02/19/log4net-vs-Enterprise-Library-Logging-Application-Block.aspx#comment</wfw:comment>
      <wfw:commentRss>http://www.yapbee.com/syndication.axd?post=5152f217-1def-4c53-8c27-66fb6b788065</wfw:commentRss>
    </item>
  </channel>
</rss>

