<?xml version="1.0" ?>
<!--
Copyright 2004-2006 The Apache Software Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<document>

	<properties>
		<author email="nicko at apache dot org">Nicko Cadell</author>
		<title>log4net Examples</title>
	</properties>

	<meta name="keywords" content="log4net examples, log4net" />
	
	<head>
		<script language="javascript" >
<!--
function getElementsByClass(node,searchClass,tag) {
var classElements = new Array();
var els = node.getElementsByTagName(tag);
var elsLen = els.length;
var pattern = new RegExp("\\b"+searchClass+"\\b");
for (i = 0, j = 0; i < elsLen; i++) {
if ( pattern.test(els[i].className) ) {
classElements[j] = els[i];
j++;
}
}
return classElements;
}
function BlockLocalOnlyLinks()
{
if (window.location.protocol!="file:")
{
var links = getElementsByClass(document,"localOnly","a");
for(var i=0; i<links.length; i++)
{
links[i].href = "#overview";
}
}
}
-->
		</script>
	</head>

	<body onload="BlockLocalOnlyLinks()">
		<section id="main" name="log4net Examples">
		
			<sectionMenu name="Contents" />

			<section id="overview" name="Overview">
				<p>
					<strong>The following examples are only available in the log4net release download, not
					on-line. To obtain the examples <a href="../downloads.html">download</a> one of the log4net releases.
					</strong>
				</p>
			</section>
			
			<section id="building" name="Building Examples">
				<section id="building-1" name="Building An Example">
					<p>
						A single example can be build by running <span class="code">nant</span> from
						the example directory.
					</p>
					<p>
						For example running <span class="code">nant</span> in the 
						<span class="code">examples\net\1.0\Tutorials\ConsoleApp\cs</span> directory
						will build the C# version of the .NET 1.0 ConsoleApp example.
					</p>
					<p>
						<span class="code">nant</span> can be run in any directory containing a
						<span class="code">nant.build</span> file. The typical behavior of the build file
						is to build all projects under the current directory.
					</p>
					<p>
						For example running <span class="code">nant</span> in the 
						<span class="code">examples\net\1.1</span> directory
						will build all the examples for the .NET 1.1 platform.
					</p>
				</section>
				
				<section id="building-all" name="Building All Examples">
					<p>
						To build all the examples either run <span class="code">nant</span> in the 
						<span class="code">examples</span> directory or you can specify the
						<span class="code">compile-examples</span> target to the main log4net nant build.
					</p>
				</section>
				
				<section id="building-vsnet" name="Visual Studio .NET">
					<p>
						There are Visual Studio .NET 2002 project files for the .NET 1.0 framework.
						The solution files for C# and VB are in the <a class="localOnly" href="../../examples/net/1.0">examples\net\1.0</a>
						folder.
					</p>
					<p>
						For the Managed C++ project there is a Visual Studio .NET 2003 project file 
						in the <a class="localOnly" href="../../examples/net/1.1">examples\net\1.1</a> folder.
					</p>
				</section>
			</section>
			
			<section id="examples" name="Examples">
			
				<section id="consoleapp" name="Tutorial - ConsoleApp">
					<p>
						ConsoleApp shows how to write a simple console application that initializes 
						logging and logs various events.
					</p>
					<p>
						This example is available for the following platforms and languages. If a version
						is not available for your chosen platform and language combination then select the
						nearest platform for the appropriate language.
					</p>
					<ul>
						<li>
							<b>MONO 1.0</b>: 
							<a class="localOnly" href="../../examples/mono/1.0/Tutorials/ConsoleApp/cs">C#</a>
						</li>
						<li>
							<b>.NET 1.0</b>: 
							<a class="localOnly" href="../../examples/net/1.0/Tutorials/ConsoleApp/cs">C#</a>, 
							<a class="localOnly" href="../../examples/net/1.0/Tutorials/ConsoleApp/vb">VB</a>
						</li>
						<li>
							<b>.NET 1.1</b>: 
							<a class="localOnly" href="../../examples/net/1.1/Tutorials/ConsoleApp/cpp">C++</a>, 
							<a class="localOnly" href="../../examples/net/1.1/Tutorials/ConsoleApp/js">JScript.NET</a>
						</li>
						<li>
							<b>.NET Compact Framework 1.0</b>: 
							<a class="localOnly" href="../../examples/netcf/1.0/Tutorials/ConsoleApp/cs">C#</a>, 
							<a class="localOnly" href="../../examples/netcf/1.0/Tutorials/ConsoleApp/vb">VB</a>
						</li>
						<li>
							<b>SSCLI 1.0</b>: 
							<a class="localOnly" href="../../examples/sscli/1.0/Tutorials/ConsoleApp/js">JScript.NET</a>
						</li>
					</ul>
					<p>
						To run this example execute <span class="code">ConsoleApp.exe</span> from the build output directory.
					</p>
				</section>
				
				<section id="webapp" name="Tutorial - WebApp">
					<p>
						ConsoleApp shows how to write a simple ASP.NET web application that initializes 
						logging and logs various events.
					</p>
					<p>
						This example is available for the following platforms and languages. If a version
						is not available for your chosen platform and language combination then select the
						nearest platform for the appropriate language.
					</p>
					<ul>
						<li>
							<b>.NET 1.0</b>: 
							<a class="localOnly" href="../../examples/net/1.0/Tutorials/WebApp/cs">C#</a>, 
							<a class="localOnly" href="../../examples/net/1.0/Tutorials/WebApp/vb">VB</a>
						</li>
					</ul>
					<p>
						To run this example you need to have an ASP.NET container application to
						host the web application, for example IIS. In IIS create a new virtual
						directory pointing to the WebApp src directory. Configure IIS to recognize
						this virtual directory as an application. Open up a web browser, navigate to
						the virtual directory and to the <span class="code">WebForm1.aspx</span> page within it.
					</p>
				</section>
				
				<section id="remotingclient" name="Remoting - RemotingClient">
					<p>
						The RemotingClient application is a simple console application that configures
						log4net with the RemotingAppender. This appender will attempt to deliver the
						logging events to a remoting listener. This example should be run in conjunction 
						with the RemotingServer.
					</p>
					<p>
						This example is available for the following platforms and languages. If a version
						is not available for your chosen platform and language combination then select the
						nearest platform for the appropriate language.
					</p>
					<ul>
						<li>
							<b>.NET 1.0</b>: 
							<a class="localOnly" href="../../examples/net/1.0/Remoting/RemotingClient/cs">C#</a>
						</li>
					</ul>
					<p>
						To run this example execute <span class="code">RemotingClient.exe</span> from the build output directory.
					</p>
				</section>
				
				<section id="remotingserver" name="Remoting - RemotingServer">
					<p>
						The RemotingServer application is a simple console application that listens for
						logging events from a remote RemotingAppender and then logs them through the
						local log4net instance. This example should be run in conjunction 
						with the RemotingClient.
					</p>
					<p>
						This example is available for the following platforms and languages. If a version
						is not available for your chosen platform and language combination then select the
						nearest platform for the appropriate language.
					</p>
					<ul>
						<li>
							<b>.NET 1.0</b>: 
							<a class="localOnly" href="../../examples/net/1.0/Remoting/RemotingServer/cs">C#</a>
						</li>
					</ul>
					<p>
						To run this example execute <span class="code">RemotingServer.exe</span> from the build output directory.
						While this process is running execute the <span class="code">RemotingClient.exe</span> program on
						the same machine. The logging events from the client are transferred to the server.
					</p>
				</section>
				
				<section id="rep-simple" name="Repository - SimpleModule">
					<p>
						The SimpleModule is a class library that is intended to be used as part of
						the SimpleApp example,
						This class library uses the <span class="code">log4net.Config.Repository</span>
						attribute to create a separate configuration space from other assemblies.
					</p>
					<p>
						This example is available for the following platforms and languages. If a version
						is not available for your chosen platform and language combination then select the
						nearest platform for the appropriate language.
					</p>
					<ul>
						<li>
							<b>MONO 1.0</b>: 
							<a class="localOnly" href="../../examples/mono/1.0/Repository/SimpleModule/cs">C#</a>
						</li>
						<li>
							<b>.NET 1.0</b>: 
							<a class="localOnly" href="../../examples/net/1.0/Repository/SimpleModule/cs">C#</a>, 
							<a class="localOnly" href="../../examples/net/1.0/Repository/SimpleModule/vb">VB</a>
						</li>
						<li>
							<b>.NET 1.1</b>: 
							<a class="localOnly" href="../../examples/net/1.1/Repository/SimpleModule/js">JScript.NET</a>
						</li>
						<li>
							<b>SSCLI 1.0</b>: 
							<a class="localOnly" href="../../examples/sscli/1.0/Repository/SimpleModule/cs">C#</a>
						</li>
					</ul>
					<p>
						This library is intended to be used as part of the SimpleApp example.
					</p>
				</section>
				
				<section id="rep-shared" name="Repository - SharedModule">
					<p>
						The SharedModule is a class library that is intended to be used as part of
						the SimpleApp example,
						This class library uses log4net but does not attempt to configure logging.
					</p>
					<p>
						This example is available for the following platforms and languages. If a version
						is not available for your chosen platform and language combination then select the
						nearest platform for the appropriate language.
					</p>
					<ul>
						<li>
							<b>MONO 1.0</b>: 
							<a class="localOnly" href="../../examples/mono/1.0/Repository/SharedModule/cs">C#</a>
						</li>
						<li>
							<b>.NET 1.0</b>: 
							<a class="localOnly" href="../../examples/net/1.0/Repository/SharedModule/cs">C#</a>, 
							<a class="localOnly" href="../../examples/net/1.0/Repository/SharedModule/vb">VB</a>
						</li>
						<li>
							<b>.NET 1.1</b>: 
							<a class="localOnly" href="../../examples/net/1.1/Repository/SharedModule/js">JScript.NET</a>
						</li>
						<li>
							<b>SSCLI 1.0</b>: 
							<a class="localOnly" href="../../examples/sscli/1.0/Repository/SharedModule/cs">C#</a>
						</li>
					</ul>
					<p>
						This library is intended to be used as part of the SimpleApp example.
					</p>
				</section>
				
				<section id="rep-app" name="Repository - SimpleApp">
					<p>
						The SimpleApp example uses the SimpleModule and SharedModule to demonstrate
						the ways in which multiple assemblies within the same process may be 
						separately configured.
					</p>
					<p>
						This example is available for the following platforms and languages. If a version
						is not available for your chosen platform and language combination then select the
						nearest platform for the appropriate language.
					</p>
					<ul>
						<li>
							<b>MONO 1.0</b>: 
							<a class="localOnly" href="../../examples/mono/1.0/Repository/SimpleApp/cs">C#</a>
						</li>
						<li>
							<b>.NET 1.0</b>: 
							<a class="localOnly" href="../../examples/net/1.0/Repository/SimpleApp/cs">C#</a>, 
							<a class="localOnly" href="../../examples/net/1.0/Repository/SimpleApp/vb">VB</a>
						</li>
						<li>
							<b>.NET 1.1</b>: 
							<a class="localOnly" href="../../examples/net/1.1/Repository/SimpleApp/js">JScript.NET</a>
						</li>
						<li>
							<b>SSCLI 1.0</b>: 
							<a class="localOnly" href="../../examples/sscli/1.0/Repository/SimpleApp/cs">C#</a>
						</li>
					</ul>
					<p>
						To run this example execute <span class="code">SimpleApp.exe</span> from the build output directory.
					</p>
				</section>
				
				<section id="eventidlogapp" name="Extensibility - EventIDLogApp">
					<p>
						The EventIDLogApp example demonstrates using the log4net.Ext.EventID extension.
						The extension needs to be built separately from the 
						<span class="code">extensions\net\1.0\log4net.Ext.EventID</span> directory.
					</p>
					<p>
						This example is available for the following platforms and languages. If a version
						is not available for your chosen platform and language combination then select the
						nearest platform for the appropriate language.
					</p>
					<ul>
						<li>
							<b>.NET 1.0</b>: 
							<a class="localOnly" href="../../examples/net/1.0/Extensibility/EventIDLogApp/cs">C#</a>
						</li>
					</ul>
					<p>
						To run this example execute <span class="code">EventIDLogApp.exe</span> from the build output directory.
					</p>
				</section>
				
				<section id="tracelogapp" name="Extensibility - TraceLogApp">
					<p>
						The TraceLogApp example demonstrates using the log4net.Ext.Trace extension.
						The extension needs to be built separately from the 
						<span class="code">extensions\net\1.0\log4net.Ext.Trace</span> directory.
					</p>
					<p>
						This example is available for the following platforms and languages. If a version
						is not available for your chosen platform and language combination then select the
						nearest platform for the appropriate language.
					</p>
					<ul>
						<li>
							<b>.NET 1.0</b>: 
							<a class="localOnly" href="../../examples/net/1.0/Extensibility/TraceLogApp/cs">C#</a>
						</li>
					</ul>
					<p>
						To run this example execute <span class="code">TraceLogApp.exe</span> from the build output directory.
					</p>
				</section>
				
				<section id="sampleappenders" name="SampleAppenders">
					<p>
						This project includes the following example appenders.
					</p>
					<ul>
						<li>
							AsyncAppender
						</li>
						<li>
							FastDbAppender
						</li>
						<li>
							FireEventAppender
						</li>
						<li>
							MessageBoxAppender
						</li>
						<li>
							MessageObjectExpanderAppender
						</li>
						<li>
							MsmqAppender
						</li>
						<li>
							PatternFileAppender
						</li>
						<li>
							SimpleSmtpAppender
						</li>
					</ul>
					<p>
						This example is available for the following platforms and languages. If a version
						is not available for your chosen platform and language combination then select the
						nearest platform for the appropriate language.
					</p>
					<ul>
						<li>
							<b>.NET 1.0</b>: 
							<a class="localOnly" href="../../examples/net/1.0/Appenders/SampleAppendersApp/cs">C#</a>
						</li>
					</ul>
					<p>
						To run this example execute <span class="code">SampleAppendersApp.exe</span> from the build output directory.
					</p>
				</section>
				
				<section id="samplelayouts" name="SampleLayouts">
					<p>
						This project includes the following example layouts.
					</p>
					<ul>
						<li>
							ForwardingLayout
						</li>
						<li>
							LineWrappingLayout
						</li>
					</ul>
					<p>
						This example is available for the following platforms and languages. If a version
						is not available for your chosen platform and language combination then select the
						nearest platform for the appropriate language.
					</p>
					<ul>
						<li>
							<b>.NET 1.0</b>: 
							<a class="localOnly" href="../../examples/net/1.0/Layouts/SampleLayoutsApp/cs">C#</a>
						</li>
					</ul>
					<p>
						To run this example execute <span class="code">SampleLayoutsApp.exe</span> from the build output directory.
					</p>
				</section>				
				
				<section id="perf-notlogging" name="Performance - NotLogging">
					<p>
						The NotLogging example benchmarks the performance of log4net logging statements in
						user code in various scenarios including when logging is disabled. 
					</p>
					<p>
						This example is available for the following platforms and languages. If a version
						is not available for your chosen platform and language combination then select the
						nearest platform for the appropriate language.
					</p>
					<ul>
						<li>
							<b>MONO 1.0</b>: 
							<a class="localOnly" href="../../examples/mono/1.0/Performance/NotLogging/cs">C#</a>
						</li>
						<li>
							<b>.NET 1.0</b>: 
							<a class="localOnly" href="../../examples/net/1.0/Performance/NotLogging/cs">C#</a>, 
							<a class="localOnly" href="../../examples/net/1.0/Performance/NotLogging/vb">VB</a>
						</li>
					</ul>
					<p>
					</p>
				</section>
				
				<section id="wmiappender" name="WmiAppender">
					<p>
						The WmiAppender sample shows an example appender that fires events through
						Windows Management Instrumentation. 
					</p>
					<p>
						This example is available for the following platforms and languages. If a version
						is not available for your chosen platform and language combination then select the
						nearest platform for the appropriate language.
					</p>
					<ul>
						<li>
							<b>.NET 1.0</b>: 
							<a class="localOnly" href="../../examples/net/1.0/Appenders/WmiAppender/cs">C#</a>
						</li>
					</ul>
					<p>
					</p>
				</section>
				
			</section>
			
		</section>
	</body>
</document>
