nicko       2004/01/28 12:03:47

  Added:       examples/mono nant.build nant.config
               examples/mono/1.0 nant.build nant.config
               examples/mono/1.0/Performance nant.build nant.config
               examples/mono/1.0/Performance/NotLogging nant.build
                        nant.config
               examples/mono/1.0/Performance/NotLogging/cs .cvsignore
                        nant.build nant.config
               examples/mono/1.0/Performance/NotLogging/cs/src
                        AssemblyInfo.cs NotLogging.cs
               examples/mono/1.0/Repository nant.build nant.config
               examples/mono/1.0/Repository/SharedModule nant.build
                        nant.config
               examples/mono/1.0/Repository/SharedModule/cs .cvsignore
                        nant.build nant.config
               examples/mono/1.0/Repository/SharedModule/cs/src
                        AssemblyInfo.cs Math.cs
               examples/mono/1.0/Repository/SimpleApp nant.build
                        nant.config
               examples/mono/1.0/Repository/SimpleApp/cs .cvsignore
                        nant.build nant.config
               examples/mono/1.0/Repository/SimpleApp/cs/src App.config
                        AssemblyInfo.cs EntryPoint.cs SimpleApp.exe.log4net
               examples/mono/1.0/Repository/SimpleModule nant.build
                        nant.config
               examples/mono/1.0/Repository/SimpleModule/cs .cvsignore
                        nant.build nant.config
               examples/mono/1.0/Repository/SimpleModule/cs/src
                        AssemblyInfo.cs Math.cs SimpleModule.dll.log4net
               examples/mono/1.0/Tutorials nant.build nant.config
               examples/mono/1.0/Tutorials/ConsoleApp nant.build
                        nant.config
               examples/mono/1.0/Tutorials/ConsoleApp/cs .cvsignore
                        nant.build nant.config
               examples/mono/1.0/Tutorials/ConsoleApp/cs/src App.config
                        AssemblyInfo.cs LoggingExample.cs
  Log:
  Initial checkin
  
  Revision  Changes    Path
  1.1                  logging-log4net/examples/mono/nant.build
  
  Index: nant.build
  ===================================================================
  <?xml version="1.0" ?>
  <project name="mono-examples" default="compile" 
xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- compile Mono examples -->
      <target name="compile" description="Builds Mono examples">
          <nant buildfile="1.0/nant.build" target="compile" />
      </target>
  </project>
  
  
  
  1.1                  logging-log4net/examples/mono/nant.config
  
  Index: nant.config
  ===================================================================
  <?xml version="1.0" ?>
  <project name="mono-configuration" xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- Include parent configuration file -->
      <include buildfile="../nant.config" />
      <!-- Set runtime configuration -->
      <property name="project.runtime.config" value="mono" readonly="false" />
  </project>
  
  
  
  1.1                  logging-log4net/examples/mono/1.0/nant.build
  
  Index: nant.build
  ===================================================================
  <?xml version="1.0" ?>
  <project name="mono-1.0-examples" default="compile" 
xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- include configuration file -->
      <include buildfile="nant.config" />
      <!-- compile all Mono 1.0 examples -->
      <target name="compile" description="Builds Mono 1.0 examples">
          <available type="Framework" 
resource="${project.runtime.config}-${project.runtime.version}"
              property="temp.framework.available" />
          <if propertytrue="temp.framework.available">
              <nant buildfile="Repository/nant.build" target="compile" />
              <nant buildfile="Performance/nant.build" target="compile" />
              <nant buildfile="Tutorials/nant.build" target="compile" />
          </if>
          <ifnot propertytrue="temp.framework.available" failonerror="true">
              <available type="Framework" 
resource="${project.runtime.config}-${project.runtime.version}-linux"
                  property="temp.framework.available" />
              <if propertytrue="temp.framework.available">
                  <nant buildfile="Repository/nant.build" target="compile" />
                  <nant buildfile="Performance/nant.build" target="compile" />
                  <nant buildfile="Tutorials/nant.build" target="compile" />
              </if>
              <ifnot propertytrue="temp.framework.available">
                  <if propertyexists="project.build.package" 
propertytrue="project.build.package">
                      <fail message="${project.runtime.description} is not 
available." />
                  </if>
                  <ifnot propertyexists="project.build.package" 
propertytrue="project.build.package">
                      <echo message="${project.runtime.description} is not 
available. Examples skipped." />
                  </ifnot>
              </ifnot>
          </ifnot>
      </target>
  </project>
  
  
  
  1.1                  logging-log4net/examples/mono/1.0/nant.config
  
  Index: nant.config
  ===================================================================
  <?xml version="1.0" ?>
  <project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- Include parent configuration file -->
      <include buildfile="../nant.config" />
      <!-- Set runtime version -->
      <property name="project.runtime.version" value="1.0" readonly="false" />
      <!-- Set runtime description -->
      <property name="project.runtime.description" value="Mono 1.0" 
readonly="false" />
  </project>
  
  
  
  1.1                  logging-log4net/examples/mono/1.0/Performance/nant.build
  
  Index: nant.build
  ===================================================================
  <?xml version="1.0" ?>
  <project name="performance-examples" default="compile" 
xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- compile Performance examples -->
      <target name="compile" description="Builds Performance examples">
          <nant buildfile="NotLogging/nant.build" target="compile" />
      </target>
  </project>
  
  
  
  1.1                  logging-log4net/examples/mono/1.0/Performance/nant.config
  
  Index: nant.config
  ===================================================================
  <?xml version="1.0" ?>
  <project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- Include parent configuration file -->
      <include buildfile="../nant.config" />
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Performance/NotLogging/nant.build
  
  Index: nant.build
  ===================================================================
  <?xml version="1.0" ?>
  <project name="notlogging-example" default="compile" 
xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- compile NotLogging example -->
      <target name="compile" description="Builds NotLogging example">
          <nant buildfile="cs/nant.build" target="compile" />
      </target>
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Performance/NotLogging/nant.config
  
  Index: nant.config
  ===================================================================
  <?xml version="1.0" ?>
  <project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- Include parent configuration file -->
      <include buildfile="../nant.config" />
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Performance/NotLogging/cs/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  bin
  doc
  gc.log
  
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Performance/NotLogging/cs/nant.build
  
  Index: nant.build
  ===================================================================
  <?xml version="1.0" ?>
  <project name="log4net-samples" default="compile" 
xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- Include configuration file -->
      <include buildfile="nant.config" />
      <!-- Include log4net helpers -->
      <include buildfile="${log4net.basedir}/log4net.include" />
      <!-- Targets that should always be executed -->
      <call target="set-build-configuration" />
      <call 
target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration"
 />
      <!-- Target for compiling the example -->
      <target name="compile" description="Builds the example" 
depends="check-current-bin-dir, clean-current-bin-dir, 
check-current-build-defines, check-current-build-config, 
check-current-build-debug, check-current-runtime-config, 
check-current-runtime-version, check-log4net-assembly">
          <!-- copy log4net build output  -->
          <copy todir="${current.bin.dir}">
              <fileset basedir="${log4net.basedir}/${current.bin.dir}">
                  <includes name="*.*" />
              </fileset>
          </copy>
          <!-- compile the example -->
          <csc noconfig="true" target="exe" warnaserror="true" 
debug="${current.build.debug}" define="${current.build.defines.csc}"
              output="${current.bin.dir}/NotLogging.exe">
              <sources defaultexcludes="true">
                  <includes name="src/**/*.cs" />
                  <includes 
name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
              </sources>
              <references basedir="${current.bin.dir}" defaultexcludes="true">
                  <includes name="log4net.dll" frompath="false" />
              </references>
          </csc>
      </target>
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Performance/NotLogging/cs/nant.config
  
  Index: nant.config
  ===================================================================
  <?xml version="1.0" ?>
  <project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- Include parent configuration file -->
      <include buildfile="../nant.config" />
      <!-- Set log4net base directory -->
      <property name="log4net.basedir" value="../../../../../../" 
readonly="false" />
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Performance/NotLogging/cs/src/AssemblyInfo.cs
  
  Index: AssemblyInfo.cs
  ===================================================================
  #region Copyright
  // 
  // This framework is based on log4j see http://jakarta.apache.org/log4j
  // Copyright (C) The Apache Software Foundation. All rights reserved.
  //
  // This software is published under the terms of the Apache Software
  // License version 1.1, a copy of which has been included with this
  // distribution in the LICENSE.txt file.
  // 
  #endregion
  
  using System.Reflection;
  using System.Runtime.CompilerServices;
  
  //
  // General Information about an assembly is controlled through the following 
  // set of attributes. Change these attribute values to modify the information
  // associated with an assembly.
  //
  [assembly: AssemblyTitle("log4net - NotLogging")]
  [assembly: AssemblyDescription("log4net performance test - NotLogging")]
  [assembly: AssemblyConfiguration("")]
  [assembly: AssemblyCompany("Neoworks Limited")]
  [assembly: AssemblyProduct("log4net - NotLogging")]
  [assembly: AssemblyCopyright("Copyright (C) 2001-2003 Neoworks Limited. All 
Rights Reserved.")]
  [assembly: AssemblyTrademark("Copyright (C) 2001-2003 Neoworks Limited. All 
Rights Reserved.")]
  [assembly: AssemblyCulture("")]               
  
  //
  // In order to sign your assembly you must specify a key to use. Refer to the 
  // Microsoft .NET Framework documentation for more information on assembly 
signing.
  //
  // Use the attributes below to control which key is used for signing. 
  //
  // Notes: 
  //   (*) If no key is specified, the assembly is not signed.
  //   (*) KeyName refers to a key that has been installed in the Crypto Service
  //       Provider (CSP) on your machine. KeyFile refers to a file which 
contains
  //       a key.
  //   (*) If the KeyFile and the KeyName values are both specified, the 
  //       following processing occurs:
  //       (1) If the KeyName can be found in the CSP, that key is used.
  //       (2) If the KeyName does not exist and the KeyFile does exist, the 
key 
  //           in the KeyFile is installed into the CSP and used.
  //   (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) 
utility.
  //       When specifying the KeyFile, the location of the KeyFile should be
  //       relative to the project output directory which is
  //       %Project Directory%\obj\<configuration>. For example, if your 
KeyFile is
  //       located in the project directory, you would specify the 
AssemblyKeyFile 
  //       attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
  //   (*) Delay Signing is an advanced option - see the Microsoft .NET 
Framework
  //       documentation for more information on this.
  //
  [assembly: AssemblyDelaySign(false)]
  [assembly: AssemblyKeyFile("")]
  [assembly: AssemblyKeyName("")]
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Performance/NotLogging/cs/src/NotLogging.cs
  
  Index: NotLogging.cs
  ===================================================================
  #region Copyright
  // 
  // This framework is based on log4j see http://jakarta.apache.org/log4j
  // Copyright (C) The Apache Software Foundation. All rights reserved.
  //
  // This software is published under the terms of the Apache Software
  // License version 1.1, a copy of which has been included with this
  // distribution in the LICENSE.txt file.
  // 
  #endregion
  
  namespace NotLogging 
  {
        using System;
        using System.Collections;
  
        using log4net;
        using log4net.Appender;
        using log4net.Layout;
        using log4net.Repository;
        using log4net.Repository.Hierarchy;
  
        public class NotLogging 
        {
                #region Init Code
  
                private static int WARM_UP_CYCLES = 10000;
  
                static readonly ILog SHORT_LOG = 
LogManager.GetLogger("A0123456789");
                static readonly ILog MEDIUM_LOG= 
LogManager.GetLogger("A0123456789.B0123456789");
                static readonly ILog LONG_LOG  = 
LogManager.GetLogger("A0123456789.B0123456789.C0123456789");
  
                static readonly ILog INEXISTENT_SHORT_LOG = 
LogManager.GetLogger("I0123456789");
                static readonly ILog INEXISTENT_MEDIUM_LOG= 
LogManager.GetLogger("I0123456789.B0123456789");
                static readonly ILog INEXISTENT_LONG_LOG  = 
LogManager.GetLogger("I0123456789.B0123456789.C0123456789");
  
  
                static readonly ILog[] LOG_ARRAY = new ILog[] {
                                                                                
                                  SHORT_LOG, 
                                                                                
                                  MEDIUM_LOG, 
                                                                                
                                  LONG_LOG, 
                                                                                
                                  INEXISTENT_SHORT_LOG,
                                                                                
                                  INEXISTENT_MEDIUM_LOG,
                                                                                
                                  INEXISTENT_LONG_LOG};
  
                static readonly TimedTest[] TIMED_TESTS = new TimedTest[] {
                                                                                
                                                          new 
SimpleMessage_Bare(),
                                                                                
                                                          new 
SimpleMessage_Array(),
                                                                                
                                                          new 
SimpleMessage_MethodGuard_Bare(),
                                                                                
                                                          new 
SimpleMessage_LocalGuard_Bare(),
                                                                                
                                                          new 
ComplexMessage_Bare(),
                                                                                
                                                          new 
ComplexMessage_Array(),
                                                                                
                                                          new 
ComplexMessage_MethodGuard_Bare(),
                                                                                
                                                          new 
ComplexMessage_MethodGuard_Array(),
                                                                                
                                                          new 
ComplexMessage_MemberGuard_Bare(),
                                                                                
                                                          new 
ComplexMessage_LocalGuard_Bare()};
  
                private static void Usage() 
                {
                        System.Console.WriteLine(
                                "Usage: NotLogging <true|false> <runLength>" + 
Environment.NewLine +
                                "\t true indicates shipped code" + 
Environment.NewLine +
                                "\t false indicates code in development" + 
Environment.NewLine +
                                "\t runLength is an int representing the run 
length of loops"  + Environment.NewLine +
                                "\t We suggest that runLength be at least 
1000000 (1 million).");
                        Environment.Exit(1);
                }
  
  
                /// <summary>
                /// Program wide initialization method
                /// </summary>
                /// <param name="args"></param>
                private static int ProgramInit(String[] args) 
                {
                        int runLength = 0;
  
                        try 
                        {
                                runLength = int.Parse(args[1]);      
                        }
                        catch(Exception e) 
                        {
                                System.Console.Error.WriteLine(e);
                                Usage();
                        }      
      
                        ConsoleAppender appender = new ConsoleAppender(new 
SimpleLayout());
            
                        if("false" == args[0]) 
                        {
                                // nothing to do
                        } 
                        else if ("true" == args[0]) 
                        {
                                System.Console.WriteLine("Flagging as shipped 
code.");
                                
((Hierarchy)LogManager.GetLoggerRepository()).Threshold = 
log4net.Core.Level.Warn;
                        } 
                        else 
                        {
                                Usage();
                        }
  
                        ((Logger)SHORT_LOG.Logger).Level = 
log4net.Core.Level.Info;
                        
((Hierarchy)LogManager.GetLoggerRepository()).Root.Level = 
log4net.Core.Level.Info;
                        
((Hierarchy)LogManager.GetLoggerRepository()).Root.AddAppender(appender);
  
                        return runLength;
                }    
          
                #endregion
  
                /// <summary>
                /// The main entry point for the application.
                /// </summary>
                [STAThread]
                static void Main(string[] argv) 
                {
                        if (System.Diagnostics.Debugger.IsAttached) 
                        {
                                WARM_UP_CYCLES = 0;
                                argv = new string[] { "false", "2" };
                        }
                        if(argv.Length != 2) 
                        {
                                Usage();
                        }
  
                        int runLength = ProgramInit(argv);
  
                        System.Console.WriteLine();
                        System.Console.Write("Warming Up...");
  
                        if (WARM_UP_CYCLES > 0) 
                        {
                                foreach(ILog logger in LOG_ARRAY) 
                                {
                                        foreach(TimedTest timedTest in 
TIMED_TESTS) 
                                        {
                                                timedTest.Run(logger, 
WARM_UP_CYCLES);
                                        }
                                }
                        }
                        System.Console.WriteLine("Done");
                        System.Console.WriteLine();
  
                        // Calculate maximum description length
                        int maxDescLen = 0;
                        foreach(TimedTest timedTest in TIMED_TESTS) 
                        {
                                maxDescLen = Math.Max(maxDescLen, 
timedTest.Description.Length);
                        }
  
                        string formatString = "{0,-"+(maxDescLen+1)+"} {1,9:G} 
ticks. Log: {2}";
                        double delta;
  
                        ArrayList averageData = new ArrayList();
  
                        foreach(TimedTest timedTest in TIMED_TESTS) 
                        {
                                double total = 0;
                                foreach(ILog logger in LOG_ARRAY) 
                                {
                                        delta = timedTest.Run(logger, 
runLength);
                                        
System.Console.WriteLine(string.Format(formatString, timedTest.Description, 
delta, ((Logger)logger.Logger).Name));
  
                                        total += delta;
                                }
                                System.Console.WriteLine();
  
                                averageData.Add(new object[] { timedTest, 
total/((double)LOG_ARRAY.Length) });
                        }
                        System.Console.WriteLine();
                        System.Console.WriteLine("Averages:");
                        System.Console.WriteLine();
  
                        foreach(object[] pair in averageData) 
                        {
                                string avgFormatString = 
"{0,-"+(maxDescLen+1)+"} {1,9:G} ticks.";
                                
System.Console.WriteLine(string.Format(avgFormatString, 
((TimedTest)pair[0]).Description, ((double)pair[1])));
                        }
                }
        }
  
        abstract class TimedTest 
        {
                abstract public double Run(ILog log, long runLength);
                abstract public string Description {get;}
        }
  
        #region Tests calling Debug(string)
  
        class SimpleMessage_Bare : TimedTest 
        {
                override public double Run(ILog log, long runLength) 
                {
                        DateTime before = DateTime.Now;
                        for(int i = 0; i < runLength; i++) 
                        {
                                log.Debug("msg");
                        }
                        DateTime after = DateTime.Now;
                        TimeSpan diff = after - before;
                        return ((double)diff.Ticks)/((double)runLength);
                }
  
                override public string Description 
                {
                        get { return "log.Debug(\"msg\");"; }
                }
        }
        class ComplexMessage_MethodGuard_Bare : TimedTest 
        {
                override public double Run(ILog log, long runLength) 
                {
                        DateTime before = DateTime.Now;
                        for(int i = 0; i < runLength; i++) 
                        {
                                if(log.IsDebugEnabled) 
                                {
                                        log.Debug("msg" + i + "msg");
                                }
                        }    
                        DateTime after = DateTime.Now;
                        TimeSpan diff = after - before;
                        return ((double)diff.Ticks)/((double)runLength);
                }
  
                override public string Description 
                {
                        get { return "if(log.IsDebugEnabled) log.Debug(\"msg\" 
+ i + \"msg\");"; }
                }
        }
        class ComplexMessage_Bare : TimedTest 
        {
                override public double Run(ILog log, long runLength) 
                {
                        DateTime before = DateTime.Now;
                        for(int i = 0; i < runLength; i++) 
                        {
                                log.Debug("msg" + i + "msg");
                        }
                        DateTime after = DateTime.Now;
                        TimeSpan diff = after - before;
                        return ((double)diff.Ticks)/((double)runLength);
                }
  
                override public string Description 
                {
                        get { return "log.Debug(\"msg\" + i + \"msg\");"; }
                }
        }
  
        #endregion
  
        #region Tests calling Debug(new object[] { ... })
  
        class SimpleMessage_Array : TimedTest 
        {
                override public double Run(ILog log, long runLength) 
                {
                        DateTime before = DateTime.Now;
                        for(int i = 0; i < runLength; i++) 
                        {
                                log.Debug(new object[] { "msg" });
                        }
                        DateTime after = DateTime.Now;
                        TimeSpan diff = after - before;
                        return ((double)diff.Ticks)/((double)runLength);
                }
  
                override public string Description 
                {
                        get { return "log.Debug(new object[] { \"msg\" });"; }
                }
        }
        class ComplexMessage_MethodGuard_Array : TimedTest 
        {
                override public double Run(ILog log, long runLength) 
                {
                        DateTime before = DateTime.Now;
                        for(int i = 0; i < runLength; i++) 
                        {
                                if(log.IsDebugEnabled) 
                                {
                                        log.Debug(new object[] { "msg" , i , 
"msg" });
                                }
                        }    
                        DateTime after = DateTime.Now;
                        TimeSpan diff = after - before;
                        return ((double)diff.Ticks)/((double)runLength);
                }
  
                override public string Description 
                {
                        get { return "if(log.IsDebugEnabled) log.Debug(new 
object[] { \"msg\" , i , \"msg\" });"; }
                }
        }
        class ComplexMessage_Array : TimedTest 
        {
                override public double Run(ILog log, long runLength) 
                {
                        DateTime before = DateTime.Now;
                        for(int i = 0; i < runLength; i++) 
                        {
                                log.Debug(new object[] { "msg" , i , "msg" });
                        }
                        DateTime after = DateTime.Now;
                        TimeSpan diff = after - before;
                        return ((double)diff.Ticks)/((double)runLength);
                }
  
                override public string Description 
                {
                        get { return "log.Debug(new object[] { \"msg\" , i , 
\"msg\" });"; }
                }
        }
  
        #endregion
  
        #region Tests calling Debug(string) (using class members)
  
        class ComplexMessage_MemberGuard_Bare : TimedTest 
        {
                override public double Run(ILog log, long runLength) 
                {
                        return (new Impl(log)).Run(runLength);
                }
  
                override public string Description 
                {
                        get { return "if(m_isEnabled) m_log.Debug(\"msg\" + i + 
\"msg\");"; }
                }
  
                class Impl 
                {
                        private readonly ILog m_log;
                        private readonly bool m_isEnabled;
  
                        public Impl(ILog log) 
                        {
                                m_log = log;
                                m_isEnabled = m_log.IsDebugEnabled;
                        }
  
                        public double Run(long runLength) 
                        {
  
                                DateTime before = DateTime.Now;
                                for(int i = 0; i < runLength; i++) 
                                {
                                        if(m_isEnabled) 
                                        {
                                                m_log.Debug("msg" + i + "msg");
                                        }
                                }    
                                DateTime after = DateTime.Now;
                                TimeSpan diff = after - before;
                                return ((double)diff.Ticks)/((double)runLength);
                        }
                }
        }
        class SimpleMessage_LocalGuard_Bare : TimedTest 
        {
                override public double Run(ILog log, long runLength) 
                {
                        bool isEnabled = log.IsDebugEnabled;
  
                        DateTime before = DateTime.Now;
                        for(int i = 0; i < runLength; i++) 
                        {
                                if (isEnabled) log.Debug("msg");
                        }
                        DateTime after = DateTime.Now;
                        TimeSpan diff = after - before;
                        return ((double)diff.Ticks)/((double)runLength);
                }
  
                override public string Description 
                {
                        get { return "if (isEnabled) log.Debug(\"msg\");"; }
                }
        }
        class SimpleMessage_MethodGuard_Bare : TimedTest 
        {
                override public double Run(ILog log, long runLength) 
                {
                        DateTime before = DateTime.Now;
                        for(int i = 0; i < runLength; i++) 
                        {
                                if (log.IsDebugEnabled) log.Debug("msg");
                        }
                        DateTime after = DateTime.Now;
                        TimeSpan diff = after - before;
                        return ((double)diff.Ticks)/((double)runLength);
                }
  
                override public string Description 
                {
                        get { return "if (log.IsDebugEnabled) 
log.Debug(\"msg\");"; }
                }
        }
        class ComplexMessage_LocalGuard_Bare : TimedTest 
        {
                override public double Run(ILog log, long runLength) 
                {
                        bool isEnabled = log.IsDebugEnabled;
  
                        DateTime before = DateTime.Now;
                        for(int i = 0; i < runLength; i++) 
                        {
                                if(isEnabled) log.Debug("msg" + i + "msg");
                        }    
                        DateTime after = DateTime.Now;
                        TimeSpan diff = after - before;
                        return ((double)diff.Ticks)/((double)runLength);
                }
  
                override public string Description 
                {
                        get { return "if (isEnabled) log.Debug(\"msg\" + i + 
\"msg\");"; }
                }
        }
        #endregion 
  
  }
  
  
  
  1.1                  logging-log4net/examples/mono/1.0/Repository/nant.build
  
  Index: nant.build
  ===================================================================
  <?xml version="1.0" ?>
  <project name="repository-examples" default="compile" 
xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- compile Domain examples -->
      <target name="compile" description="Builds Repository examples">
          <nant buildfile="SharedModule/nant.build" target="compile" />
          <nant buildfile="SimpleApp/nant.build" target="compile" />
          <nant buildfile="SimpleModule/nant.build" target="compile" />
      </target>
  </project>
  
  
  
  1.1                  logging-log4net/examples/mono/1.0/Repository/nant.config
  
  Index: nant.config
  ===================================================================
  <?xml version="1.0" ?>
  <project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- Include parent configuration file -->
      <include buildfile="../nant.config" />
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SharedModule/nant.build
  
  Index: nant.build
  ===================================================================
  <?xml version="1.0" ?>
  <project name="sharedmodule-example" default="compile" 
xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- compile SharedModule example -->
      <target name="compile" description="Builds SharedModule example">
          <nant buildfile="cs/nant.build" target="compile" />
      </target>
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SharedModule/nant.config
  
  Index: nant.config
  ===================================================================
  <?xml version="1.0" ?>
  <project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- Include parent configuration file -->
      <include buildfile="../nant.config" />
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SharedModule/cs/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  bin
  doc
  gc.log
  
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SharedModule/cs/nant.build
  
  Index: nant.build
  ===================================================================
  <?xml version="1.0" ?>
  <project name="log4net-samples" default="compile" 
xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- Include configuration file -->
      <include buildfile="nant.config" />
      <!-- Include log4net helpers -->
      <include buildfile="${log4net.basedir}/log4net.include" />
      <!-- Targets that should always be executed -->
      <call target="set-build-configuration" />
      <call 
target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration"
 />
      <!-- Target for compiling the example -->
      <target name="compile" description="Builds the example" 
depends="check-current-bin-dir, clean-current-bin-dir, 
check-current-build-defines, check-current-build-config, 
check-current-build-debug, check-current-runtime-config, 
check-current-runtime-version, check-log4net-assembly">
          <!-- compile the example -->
          <csc noconfig="true" warnaserror="true" target="library" 
debug="${current.build.debug}"
              define="${current.build.defines.csc}" 
output="${current.bin.dir}/SharedModule.dll">
              <sources defaultexcludes="true">
                  <includes name="src/**/*.cs" />
                  <includes 
name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
              </sources>
              <references defaultexcludes="true">
                  <includes 
name="${log4net.basedir}/bin/${current.runtime.config}/${current.runtime.version}/${current.build.config}/log4net.dll"
                      fromPath="false" />
              </references>
          </csc>
      </target>
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SharedModule/cs/nant.config
  
  Index: nant.config
  ===================================================================
  <?xml version="1.0" ?>
  <project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- Include parent configuration file -->
      <include buildfile="../nant.config" />
      <!-- Set log4net base directory -->
      <property name="log4net.basedir" value="../../../../../../" 
readonly="false" />
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SharedModule/cs/src/AssemblyInfo.cs
  
  Index: AssemblyInfo.cs
  ===================================================================
  #region Copyright
  // 
  // This framework is based on log4j see http://jakarta.apache.org/log4j
  // Copyright (C) The Apache Software Foundation. All rights reserved.
  //
  // This software is published under the terms of the Apache Software
  // License version 1.1, a copy of which has been included with this
  // distribution in the LICENSE.txt file.
  // 
  #endregion
  
  using System.Reflection;
  using System.Runtime.CompilerServices;
  
  //
  // General Information about an assembly is controlled through the following 
  // set of attributes. Change these attribute values to modify the information
  // associated with an assembly.
  //
  [assembly: AssemblyTitle("log4net - SharedModule")]
  [assembly: AssemblyDescription("log4net SharedModule")]
  [assembly: AssemblyConfiguration("")]
  [assembly: AssemblyCompany("Neoworks Limited")]
  [assembly: AssemblyProduct("log4net - SharedModule")]
  [assembly: AssemblyCopyright("Copyright (C) 2001-2003 Neoworks Limited. All 
Rights Reserved.")]
  [assembly: AssemblyTrademark("Copyright (C) 2001-2003 Neoworks Limited. All 
Rights Reserved.")]
  [assembly: AssemblyCulture("")]               
  
  //
  // In order to sign your assembly you must specify a key to use. Refer to the 
  // Microsoft .NET Framework documentation for more information on assembly 
signing.
  //
  // Use the attributes below to control which key is used for signing. 
  //
  // Notes: 
  //   (*) If no key is specified, the assembly is not signed.
  //   (*) KeyName refers to a key that has been installed in the Crypto Service
  //       Provider (CSP) on your machine. KeyFile refers to a file which 
contains
  //       a key.
  //   (*) If the KeyFile and the KeyName values are both specified, the 
  //       following processing occurs:
  //       (1) If the KeyName can be found in the CSP, that key is used.
  //       (2) If the KeyName does not exist and the KeyFile does exist, the 
key 
  //           in the KeyFile is installed into the CSP and used.
  //   (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) 
utility.
  //       When specifying the KeyFile, the location of the KeyFile should be
  //       relative to the project output directory which is
  //       %Project Directory%\obj\<configuration>. For example, if your 
KeyFile is
  //       located in the project directory, you would specify the 
AssemblyKeyFile 
  //       attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
  //   (*) Delay Signing is an advanced option - see the Microsoft .NET 
Framework
  //       documentation for more information on this.
  //
  [assembly: AssemblyDelaySign(false)]
  [assembly: AssemblyKeyFile("")]
  [assembly: AssemblyKeyName("")]
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SharedModule/cs/src/Math.cs
  
  Index: Math.cs
  ===================================================================
  #region Copyright
  // 
  // This framework is based on log4j see http://jakarta.apache.org/log4j
  // Copyright (C) The Apache Software Foundation. All rights reserved.
  //
  // This software is published under the terms of the Apache Software
  // License version 1.1, a copy of which has been included with this
  // distribution in the LICENSE.txt file.
  // 
  #endregion
  
  namespace SharedModule
  {
        /// <summary>
        /// Summary description for Math.
        /// </summary>
        public class Math
        {
                // Create a logger for use in this class
                private static readonly log4net.ILog log = 
log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
  
                public Math()
                {
                        if (log.IsDebugEnabled) log.Debug("Constructor");
                }
  
                public int Subtract(int left, int right)
                {
                        int result = left - right;
                        if (log.IsInfoEnabled) log.Info(""+left+" - "+right+" = 
"+result);
                        return result;
                }
        }
  }
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SimpleApp/nant.build
  
  Index: nant.build
  ===================================================================
  <?xml version="1.0" ?>
  <project name="simpleapp-example" default="compile" 
xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- compile SimpleApp example -->
      <target name="compile" description="Builds SimpleApp example">
          <nant buildfile="cs/nant.build" target="compile" />
      </target>
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SimpleApp/nant.config
  
  Index: nant.config
  ===================================================================
  <?xml version="1.0" ?>
  <project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- Include parent configuration file -->
      <include buildfile="../nant.config" />
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SimpleApp/cs/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  bin
  doc
  gc.log
  
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SimpleApp/cs/nant.build
  
  Index: nant.build
  ===================================================================
  <?xml version="1.0" ?>
  <project name="log4net-samples" default="compile" 
xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- Include configuration file -->
      <include buildfile="nant.config" />
      <!-- Include log4net helpers -->
      <include buildfile="${log4net.basedir}/log4net.include" />
      <!-- Targets that should always be executed -->
      <call target="set-build-configuration" />
      <call 
target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration"
 />
      <!-- Target for compiling the example -->
      <target name="compile" description="Builds the example" 
depends="check-current-bin-dir, clean-current-bin-dir, 
check-current-build-defines, check-current-build-config, 
check-current-build-debug, check-current-runtime-config, 
check-current-runtime-version, check-log4net-assembly">
          <!-- copy log4net build output  -->
          <copy todir="${current.bin.dir}">
              <fileset 
basedir="${log4net.basedir}/bin/${current.runtime.config}/${current.runtime.version}/${current.build.config}">
                  <includes name="*.*" />
              </fileset>
          </copy>
          <!-- build SharedModule assembly -->
          <nant buildfile="../../SharedModule/cs/nant.build" target="compile" 
inheritall="true" />
          <!-- build SimpleModule assembly -->
          <nant buildfile="../../SimpleModule/cs/nant.build" target="compile" 
inheritall="true" />
          <!-- copy SharedModule build output -->
          <copy todir="${current.bin.dir}">
              <fileset basedir="../../SharedModule/cs/${current.bin.dir}">
                  <includes name="*.*" />
              </fileset>
          </copy>
          <!-- copy SimpleModule build output -->
          <copy todir="${current.bin.dir}">
              <fileset basedir="../../SimpleModule/cs/${current.bin.dir}">
                  <includes name="*.*" />
              </fileset>
          </copy>
          <!-- compile the example -->
          <csc noconfig="true" warnaserror="true" target="exe" 
debug="${current.build.debug}" define="${current.build.defines.csc}"
              output="${current.bin.dir}/SimpleApp.exe">
              <sources defaultexcludes="true">
                  <includes name="src/**/*.cs" />
                  <includes 
name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
              </sources>
              <references defaultexcludes="true">
                  <includes name="${current.bin.dir}/SimpleModule.dll" 
fromPath="false" />
                  <includes name="${current.bin.dir}/SharedModule.dll" 
fromPath="false" />
                  <includes name="${current.bin.dir}/log4net.dll" 
fromPath="false" />
              </references>
          </csc>
          <!-- copy the SimpleApp log4net configuration file -->
          <copy file="src/SimpleApp.exe.log4net" todir="${current.bin.dir}" />
          <!-- copy the SimpleApp application configuration file -->
          <copy file="src/App.config" 
tofile="${current.bin.dir}/SimpleApp.exe.config" />
      </target>
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SimpleApp/cs/nant.config
  
  Index: nant.config
  ===================================================================
  <?xml version="1.0" ?>
  <project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- Include parent configuration file -->
      <include buildfile="../nant.config" />
      <!-- Set log4net base directory -->
      <property name="log4net.basedir" value="../../../../../../" 
readonly="false" />
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SimpleApp/cs/src/App.config
  
  Index: App.config
  ===================================================================
  <?xml version="1.0" encoding="utf-8" ?>
  <configuration>
      <appSettings>
          <!-- To enable internal log4net logging specify the following 
appSettings key -->
          <!-- 
              <add key="log4net.Internal.Debug" value="true"/> 
          -->
      </appSettings>
  </configuration>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SimpleApp/cs/src/AssemblyInfo.cs
  
  Index: AssemblyInfo.cs
  ===================================================================
  #region Copyright
  // 
  // This framework is based on log4j see http://jakarta.apache.org/log4j
  // Copyright (C) The Apache Software Foundation. All rights reserved.
  //
  // This software is published under the terms of the Apache Software
  // License version 1.1, a copy of which has been included with this
  // distribution in the LICENSE.txt file.
  // 
  #endregion
  
  using System.Reflection;
  using System.Runtime.CompilerServices;
  
  //
  // General Information about an assembly is controlled through the following 
  // set of attributes. Change these attribute values to modify the information
  // associated with an assembly.
  //
  [assembly: AssemblyTitle("log4net - SimpleApp")]
  [assembly: AssemblyDescription("log4net SimpleApp")]
  [assembly: AssemblyConfiguration("")]
  [assembly: AssemblyCompany("Neoworks Limited")]
  [assembly: AssemblyProduct("log4net - SimpleApp")]
  [assembly: AssemblyCopyright("Copyright (C) 2001-2003 Neoworks Limited. All 
Rights Reserved.")]
  [assembly: AssemblyTrademark("Copyright (C) 2001-2003 Neoworks Limited. All 
Rights Reserved.")]
  [assembly: AssemblyCulture("")]               
  
  //
  // In order to sign your assembly you must specify a key to use. Refer to the 
  // Microsoft .NET Framework documentation for more information on assembly 
signing.
  //
  // Use the attributes below to control which key is used for signing. 
  //
  // Notes: 
  //   (*) If no key is specified, the assembly is not signed.
  //   (*) KeyName refers to a key that has been installed in the Crypto Service
  //       Provider (CSP) on your machine. KeyFile refers to a file which 
contains
  //       a key.
  //   (*) If the KeyFile and the KeyName values are both specified, the 
  //       following processing occurs:
  //       (1) If the KeyName can be found in the CSP, that key is used.
  //       (2) If the KeyName does not exist and the KeyFile does exist, the 
key 
  //           in the KeyFile is installed into the CSP and used.
  //   (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) 
utility.
  //       When specifying the KeyFile, the location of the KeyFile should be
  //       relative to the project output directory which is
  //       %Project Directory%\obj\<configuration>. For example, if your 
KeyFile is
  //       located in the project directory, you would specify the 
AssemblyKeyFile 
  //       attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
  //   (*) Delay Signing is an advanced option - see the Microsoft .NET 
Framework
  //       documentation for more information on this.
  //
  [assembly: AssemblyDelaySign(false)]
  [assembly: AssemblyKeyFile("")]
  [assembly: AssemblyKeyName("")]
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SimpleApp/cs/src/EntryPoint.cs
  
  Index: EntryPoint.cs
  ===================================================================
  #region Copyright
  // 
  // This framework is based on log4j see http://jakarta.apache.org/log4j
  // Copyright (C) The Apache Software Foundation. All rights reserved.
  //
  // This software is published under the terms of the Apache Software
  // License version 1.1, a copy of which has been included with this
  // distribution in the LICENSE.txt file.
  // 
  #endregion
  
  // Configure logging for this assembly using the 'SimpleApp.exe.log4net' file
  [assembly: log4net.Config.XmlConfigurator(ConfigFileExtension="log4net", 
Watch=true)]
  
  // The following alias attribute can be used to capture the logging 
  // repository for the 'SimpleModule' assembly. Without specifying this 
  // attribute the logging configuration for the 'SimpleModule' assembly
  // will be read from the 'SimpleModule.dll.log4net' file. When this
  // attribute is specified the configuration will be shared with this
  // assemby's configuration.
  //[assembly: log4net.Config.AliasRepository("SimpleModule")]
  
  namespace SimpleApp
  {
        using System;
  
        /// <summary>
        /// Summary description for Class1.
        /// </summary>
        class EntryPoint
        {
                // Create a logger for use in this class
                private static readonly log4net.ILog log = 
log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
  
                /// <summary>
                /// The main entry point for the application.
                /// </summary>
                [STAThread]
                static void Main(string[] args)
                {
                        if (log.IsInfoEnabled) log.Info(args);
  
                        if (args.Length != 2)
                        {
                                log.Error("Must supply 2 command line 
arguments");
                        }
                        else
                        {
                                int left = int.Parse(args[0]);
                                int right = int.Parse(args[1]);
                                int result = 0;
  
                                if (log.IsDebugEnabled) log.Debug("Adding 
["+left+"] to ["+right+"]");
  
                                result = (new SimpleModule.Math()).Add(left, 
right);
  
                                if (log.IsDebugEnabled) log.Debug("Result 
["+result+"]");
  
                                Console.Out.WriteLine(result);
  
  
                                if (log.IsDebugEnabled) log.Debug("Subtracting 
["+right+"] from ["+left+"]");
  
                                result = (new 
SharedModule.Math()).Subtract(left, right);
  
                                if (log.IsDebugEnabled) log.Debug("Result 
["+result+"]");
  
                                Console.Out.WriteLine(result);
                        }
                }
        }
  }
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SimpleApp/cs/src/SimpleApp.exe.log4net
  
  Index: SimpleApp.exe.log4net
  ===================================================================
  <?xml version="1.0" encoding="utf-8" ?>
  <!-- This section contains the log4net configuration settings -->
  <log4net>
      <!-- Define some output appenders -->     
      <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
          <layout type="log4net.Layout.PatternLayout">
              <param name="ConversionPattern" value="[SimpleAppConfig] %d [%t] 
%-5p %c - %m%n" />
          </layout>
      </appender>
      <!-- Setup the root category, add the appenders and set the default 
priority -->
      <root>
          <level value="DEBUG" />
          <appender-ref ref="ConsoleAppender" />
      </root>
  </log4net>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SimpleModule/nant.build
  
  Index: nant.build
  ===================================================================
  <?xml version="1.0" ?>
  <project name="simplemodule-example" default="compile" 
xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- compile SimpleModule example -->
      <target name="compile" description="Builds SimpleModule example">
          <nant buildfile="cs/nant.build" target="compile" />
      </target>
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SimpleModule/nant.config
  
  Index: nant.config
  ===================================================================
  <?xml version="1.0" ?>
  <project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- Include parent configuration file -->
      <include buildfile="../nant.config" />
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SimpleModule/cs/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  bin
  doc
  gc.log
  
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SimpleModule/cs/nant.build
  
  Index: nant.build
  ===================================================================
  <?xml version="1.0" ?>
  <project name="log4net-samples" default="compile" 
xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- Include configuration file -->
      <include buildfile="nant.config" />
      <!-- Include log4net helpers -->
      <include buildfile="${log4net.basedir}/log4net.include" />
      <!-- Targets that should always be executed -->
      <call target="set-build-configuration" />
      <call 
target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration"
 />
      <!-- Target for compiling the example -->
      <target name="compile" description="Builds the example" 
depends="check-current-bin-dir, clean-current-bin-dir, 
check-current-build-defines, check-current-build-config, 
check-current-build-debug, check-current-runtime-config, 
check-current-runtime-version, check-log4net-assembly">
          <!-- compile the example -->
          <csc noconfig="true" warnaserror="true" target="library" 
debug="${current.build.debug}"
              define="${current.build.defines.csc}" 
output="${current.bin.dir}/SimpleModule.dll">
              <sources defaultexcludes="true">
                  <includes name="src/**/*.cs" />
                  <includes 
name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
              </sources>
              <references defaultexcludes="true">
                  <includes 
name="${log4net.basedir}/bin/${current.runtime.config}/${current.runtime.version}/${current.build.config}/log4net.dll"
                      fromPath="false" />
              </references>
          </csc>
          <!-- copy the log4net configuration file to the output directory -->
          <copy file="src/SimpleModule.dll.log4net" todir="${current.bin.dir}" 
/>
      </target>
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SimpleModule/cs/nant.config
  
  Index: nant.config
  ===================================================================
  <?xml version="1.0" ?>
  <project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- Include parent configuration file -->
      <include buildfile="../nant.config" />
      <!-- Set log4net base directory -->
      <property name="log4net.basedir" value="../../../../../../" 
readonly="false" />
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SimpleModule/cs/src/AssemblyInfo.cs
  
  Index: AssemblyInfo.cs
  ===================================================================
  #region Copyright
  // 
  // This framework is based on log4j see http://jakarta.apache.org/log4j
  // Copyright (C) The Apache Software Foundation. All rights reserved.
  //
  // This software is published under the terms of the Apache Software
  // License version 1.1, a copy of which has been included with this
  // distribution in the LICENSE.txt file.
  // 
  #endregion
  
  using System.Reflection;
  using System.Runtime.CompilerServices;
  
  //
  // General Information about an assembly is controlled through the following 
  // set of attributes. Change these attribute values to modify the information
  // associated with an assembly.
  //
  [assembly: AssemblyTitle("log4net - SimpleModule")]
  [assembly: AssemblyDescription("log4net SimpleModule")]
  [assembly: AssemblyConfiguration("")]
  [assembly: AssemblyCompany("Neoworks Limited")]
  [assembly: AssemblyProduct("log4net - SimpleModule")]
  [assembly: AssemblyCopyright("Copyright (C) 2001-2003 Neoworks Limited. All 
Rights Reserved.")]
  [assembly: AssemblyTrademark("Copyright (C) 2001-2003 Neoworks Limited. All 
Rights Reserved.")]
  [assembly: AssemblyCulture("")]               
  
  //
  // In order to sign your assembly you must specify a key to use. Refer to the 
  // Microsoft .NET Framework documentation for more information on assembly 
signing.
  //
  // Use the attributes below to control which key is used for signing. 
  //
  // Notes: 
  //   (*) If no key is specified, the assembly is not signed.
  //   (*) KeyName refers to a key that has been installed in the Crypto Service
  //       Provider (CSP) on your machine. KeyFile refers to a file which 
contains
  //       a key.
  //   (*) If the KeyFile and the KeyName values are both specified, the 
  //       following processing occurs:
  //       (1) If the KeyName can be found in the CSP, that key is used.
  //       (2) If the KeyName does not exist and the KeyFile does exist, the 
key 
  //           in the KeyFile is installed into the CSP and used.
  //   (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) 
utility.
  //       When specifying the KeyFile, the location of the KeyFile should be
  //       relative to the project output directory which is
  //       %Project Directory%\obj\<configuration>. For example, if your 
KeyFile is
  //       located in the project directory, you would specify the 
AssemblyKeyFile 
  //       attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
  //   (*) Delay Signing is an advanced option - see the Microsoft .NET 
Framework
  //       documentation for more information on this.
  //
  [assembly: AssemblyDelaySign(false)]
  [assembly: AssemblyKeyFile("")]
  [assembly: AssemblyKeyName("")]
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SimpleModule/cs/src/Math.cs
  
  Index: Math.cs
  ===================================================================
  #region Copyright
  // 
  // This framework is based on log4j see http://jakarta.apache.org/log4j
  // Copyright (C) The Apache Software Foundation. All rights reserved.
  //
  // This software is published under the terms of the Apache Software
  // License version 1.1, a copy of which has been included with this
  // distribution in the LICENSE.txt file.
  // 
  #endregion
  
  // We want this assembly to have a seperate logging repository to the 
  // rest of the application. We will configure this repository seperatly.
  [assembly: log4net.Config.Repository("SimpleModule")]
  
  // Configure logging for this assembly using the 'SimpleModule.dll.log4net' 
file
  [assembly: log4net.Config.XmlConfigurator(ConfigFileExtension="log4net", 
Watch=true)]
  
  namespace SimpleModule
  {
        /// <summary>
        /// Summary description for Math.
        /// </summary>
        public class Math
        {
                // Create a logger for use in this class
                private static readonly log4net.ILog log = 
log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
  
                public Math()
                {
                        if (log.IsDebugEnabled) log.Debug("Constructor");
                }
  
                public int Add(int left, int right)
                {
                        int result = left + right;
                        if (log.IsInfoEnabled) log.Info(""+left+" + "+right+" = 
"+result);
                        return result;
                }
        }
  }
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Repository/SimpleModule/cs/src/SimpleModule.dll.log4net
  
  Index: SimpleModule.dll.log4net
  ===================================================================
  <?xml version="1.0" encoding="utf-8" ?>
  <!-- This section contains the log4net configuration settings -->
  <log4net>
      <!-- Define some output appenders -->
      <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
          <layout type="log4net.Layout.PatternLayout">
              <param name="ConversionPattern" value="[SimpleModuleConfig] %d 
[%t] %-5p %c - %m%n" />
          </layout>
      </appender>
      <!-- Setup the root category, add the appenders and set the default 
priority -->
      <root>
          <level value="DEBUG" />
          <appender-ref ref="ConsoleAppender" />
      </root>
  </log4net>
  
  
  
  1.1                  logging-log4net/examples/mono/1.0/Tutorials/nant.build
  
  Index: nant.build
  ===================================================================
  <?xml version="1.0" ?>
  <project name="tutorials-examples" default="compile" 
xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- compile Tutorials examples -->
      <target name="compile" description="Builds Tutorials examples">
          <nant buildfile="ConsoleApp/nant.build" target="compile" />
      </target>
  </project>
  
  
  
  1.1                  logging-log4net/examples/mono/1.0/Tutorials/nant.config
  
  Index: nant.config
  ===================================================================
  <?xml version="1.0" ?>
  <project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- Include parent configuration file -->
      <include buildfile="../nant.config" />
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Tutorials/ConsoleApp/nant.build
  
  Index: nant.build
  ===================================================================
  <?xml version="1.0" ?>
  <project name="consoleapp-example" default="compile" 
xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- compile ConsoleApp example -->
      <target name="compile" description="Builds ConsoleApp example">
          <nant buildfile="cs/nant.build" target="compile" />
      </target>
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Tutorials/ConsoleApp/nant.config
  
  Index: nant.config
  ===================================================================
  <?xml version="1.0" ?>
  <project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- Include parent configuration file -->
      <include buildfile="../nant.config" />
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Tutorials/ConsoleApp/cs/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  bin
  doc
  gc.log
  build
  
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Tutorials/ConsoleApp/cs/nant.build
  
  Index: nant.build
  ===================================================================
  <?xml version="1.0" ?>
  <project name="log4net-samples" default="compile" 
xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- Include configuration file -->
      <include buildfile="nant.config" />
      <!-- Include log4net helpers -->
      <include buildfile="${log4net.basedir}/log4net.include" />
      <!-- Targets that should always be executed -->
      <call target="set-build-configuration" />
      <call 
target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration"
 />
      <!-- Target for compiling the example -->
      <target name="compile" description="Builds the example" 
depends="check-current-bin-dir, clean-current-bin-dir, 
check-current-build-defines, check-current-build-config, 
check-current-build-debug, check-current-runtime-config, 
check-current-runtime-version, check-log4net-assembly">
          <!-- copy log4net build output  -->
          <copy todir="${current.bin.dir}">
              <fileset basedir="${log4net.basedir}/${current.bin.dir}">
                  <includes name="*.*" />
              </fileset>
          </copy>
          <!-- compile the example -->
          <csc noconfig="true" warnaserror="true" target="exe" 
debug="${current.build.debug}" define="${current.build.defines.csc}"
              output="${current.bin.dir}/ConsoleApp.exe">
              <sources defaultexcludes="true">
                  <includes name="src/**/*.cs" />
                  <includes 
name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
              </sources>
              <references defaultexcludes="true">
                  <includes name="${current.bin.dir}/log4net.dll" 
fromPath="false" />
              </references>
          </csc>
          <!-- copy the ConsoleApp application configuration file -->
          <copy file="src/App.config" 
tofile="${current.bin.dir}/ConsoleApp.exe.config" />
      </target>
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Tutorials/ConsoleApp/cs/nant.config
  
  Index: nant.config
  ===================================================================
  <?xml version="1.0" ?>
  <project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd";>
        <!-- Include parent configuration file -->
        <include buildfile="../nant.config" />
        <!-- Set log4net base directory -->
        <property name="log4net.basedir" value="../../../../../../" 
readonly="false" />
  </project>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Tutorials/ConsoleApp/cs/src/App.config
  
  Index: App.config
  ===================================================================
  <?xml version="1.0" encoding="utf-8" ?>
  <!-- 
       .NET application configuration file
  
       This file must have the exact same name as your application with
       .config appended to it. For example if your application is ConsoleApp.exe
       then the config file must be ConsoleApp.exe.config it mut also be in the
       same directory as the application. 
  -->
  <configuration>
      <!-- Register a section handler for the log4net section -->
      <configSections>
          <section name="log4net" 
type="System.Configuration.IgnoreSectionHandler" />
      </configSections>
      <!-- Enable internal debugging in log4net -->
      <appSettings>
          <!-- To enable internal log4net logging specify the following 
appSettings key -->
          <!-- <add key="log4net.Internal.Debug" value="true"/> -->
      </appSettings>
      <!-- This section contains the log4net configuration settings -->
      <log4net>
          <!-- Define some output appenders -->
          <appender name="RollingLogFileAppender" 
type="log4net.Appender.RollingFileAppender">
              <param name="File" value="LQSS-SS-log.txt" />
              <param name="AppendToFile" value="true" />
              <param name="MaxSizeRollBackups" value="10" />
              <param name="MaximumFileSize" value="100" />
              <param name="RollingStyle" value="Size" />
              <param name="StaticLogFileName" value="true" />
              <layout type="log4net.Layout.PatternLayout">
                  <param name="Header" value="[Header]\r\n" />
                  <param name="Footer" value="[Footer]\r\n" />
                  <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - 
%m%n" />
              </layout>
          </appender>
          <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
              <param name="File" value="log-file.txt" />
              <!-- Example using environment variables in params -->
              <!-- <param name="File" value="${TMP}\\log-file.txt" /> -->
              <param name="AppendToFile" value="true" />
              <!-- An alternate output encoding can be specified -->
              <!-- <param name="Encoding" value="unicodeFFFE" /> -->
              <layout type="log4net.Layout.PatternLayout">
                  <param name="Header" value="[Header]\r\n" />
                  <param name="Footer" value="[Footer]\r\n" />
                  <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] 
&lt;%X{auth}&gt; - %m%n" />
              </layout>
              <!-- Alternate layout using XML
              <layout type="log4net.Layout.XMLLayout" /> 
              -->
          </appender>
          <appender name="ConsoleAppender" 
type="log4net.Appender.ConsoleAppender">
              <layout type="log4net.Layout.PatternLayout">
                  <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] 
&lt;%X{auth}&gt; - %m%n" />
              </layout>
          </appender>
          <!-- Example of how to configure the ADONetAppender
          <appender name="ADONetAppender" 
type="log4net.Appender.ADONetAppender" >
              <param name="ConnectionString" value="Driver={Microsoft Access 
Driver (*.mdb)};DBQ=C:\\Work\\cvs_root\\log4net-1.2\\access.mdb;UID=;PWD=;" />
              <layout type="log4net.Layout.PatternLayout">
                  <param name="ConversionPattern" value="INSERT INTO Log 
([Date],[Thread],[Level],[Logger],[Message]) VALUES ('%d','%t','%p','%c','%m')" 
/>
              </layout>
          </appender> 
          -->
          <!-- 
          <appender name="A" type="log4net.Appender.ForwardingAppender" >
              <param name="Threshold" value="WARN"/>
              <appender-ref ref="ConsoleAppender" />
          </appender>
          <appender name="B" type="log4net.Appender.ForwardingAppender" >
              <filter type="log4net.Filter.LevelRangeFilter">
                  <param name="LevelMin" value="DEBUG"/>
                  <param name="LevelMax" value="INFO"/>
              </filter>
              <appender-ref ref="ConsoleAppender" />
          </appender> 
          -->
          <!-- Example of how to configure the ADONetAppender to connect to MS 
Access -->
          <appender name="ADONetAppender_Access" 
type="log4net.Appender.ADONetAppender">
              <param name="ConnectionString" 
value="Provider=Microsoft.Jet.OLEDB.4.0;Data 
Source=C:\\Work\\cvs_root\\log4net-1.2\\access.mdb;User Id=;Password=;" />
              <param name="CommandText" value="INSERT INTO Log 
([Date],[Thread],[Level],[Logger],[Message]) VALUES (@log_date, @thread, 
@log_level, @logger, @message)" />
              <param name="Parameter">
                  <param name="ParameterName" value="@log_date" />
                  <param name="DbType" value="String" />
                  <param name="Size" value="255" />
                  <param name="Layout" type="log4net.Layout.PatternLayout">
                      <param name="ConversionPattern" value="%d" />
                  </param>
              </param>
              <param name="Parameter">
                  <param name="ParameterName" value="@thread" />
                  <param name="DbType" value="String" />
                  <param name="Size" value="255" />
                  <param name="Layout" type="log4net.Layout.PatternLayout">
                      <param name="ConversionPattern" value="%t" />
                  </param>
              </param>
              <param name="Parameter">
                  <param name="ParameterName" value="@log_level" />
                  <param name="DbType" value="String" />
                  <param name="Size" value="50" />
                  <param name="Layout" type="log4net.Layout.PatternLayout">
                      <param name="ConversionPattern" value="%p" />
                  </param>
              </param>
              <param name="Parameter">
                  <param name="ParameterName" value="@logger" />
                  <param name="DbType" value="String" />
                  <param name="Size" value="255" />
                  <param name="Layout" type="log4net.Layout.PatternLayout">
                      <param name="ConversionPattern" value="%c" />
                  </param>
              </param>
              <param name="Parameter">
                  <param name="ParameterName" value="@message" />
                  <param name="DbType" value="String" />
                  <param name="Size" value="1024" />
                  <param name="Layout" type="log4net.Layout.PatternLayout">
                      <param name="ConversionPattern" value="%m" />
                  </param>
              </param>
          </appender>
          <!-- Example of how to configure the ADONetAppender to connect to MS 
SQL Server -->
          <appender name="ADONetAppender_SqlServer" 
type="log4net.Appender.ADONetAppender">
              <param name="BufferSize" value="1" />
              <param name="ConnectionType" 
value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, 
Culture=neutral, PublicKeyToken=b77a5c561934e089" />
              <param name="ConnectionString" value="data 
source=GUINNESS;initial catalog=test_log4net;integrated security=false;persist 
security info=True;User ID=sa;Password=sql" />
              <param name="CommandText" value="INSERT INTO Log 
([Date],[Thread],[Level],[Logger],[Message]) VALUES (@log_date, @thread, 
@log_level, @logger, @message)" />
              <param name="Parameter">
                  <param name="ParameterName" value="@log_date" />
                  <param name="DbType" value="DateTime" />
                  <!-- 
                  <param name="Layout" type="log4net.Layout.PatternLayout">
                      <param name="ConversionPattern" value="%d{yyyy'-'MM'-'dd 
HH':'mm':'ss'.'fff}" />
                  </param>
                  -->
                  <param name="Layout" type="log4net.Layout.RawTimeStampLayout" 
/>
              </param>
              <param name="Parameter">
                  <param name="ParameterName" value="@thread" />
                  <param name="DbType" value="String" />
                  <param name="Size" value="255" />
                  <param name="Layout" type="log4net.Layout.PatternLayout">
                      <param name="ConversionPattern" value="%t" />
                  </param>
              </param>
              <param name="Parameter">
                  <param name="ParameterName" value="@log_level" />
                  <param name="DbType" value="String" />
                  <param name="Size" value="50" />
                  <param name="Layout" type="log4net.Layout.PatternLayout">
                      <param name="ConversionPattern" value="%p" />
                  </param>
              </param>
              <param name="Parameter">
                  <param name="ParameterName" value="@logger" />
                  <param name="DbType" value="String" />
                  <param name="Size" value="255" />
                  <param name="Layout" type="log4net.Layout.PatternLayout">
                      <param name="ConversionPattern" value="%c" />
                  </param>
              </param>
              <param name="Parameter">
                  <param name="ParameterName" value="@message" />
                  <param name="DbType" value="String" />
                  <param name="Size" value="4000" />
                  <param name="Layout" type="log4net.Layout.PatternLayout">
                      <param name="ConversionPattern" value="%m" />
                  </param>
              </param>
          </appender>
          <!-- Setup the root category, add the appenders and set the default 
level -->
          <root>
              <level value="WARN" />
              <appender-ref ref="LogFileAppender" />
              <appender-ref ref="ConsoleAppender" />
              <!-- <appender-ref ref="ADONetAppender_SqlServer" /> -->
              <!-- <appender-ref ref="A" /> -->
          </root>
          <!-- Specify the level for some specific categories -->
          <logger name="ConsoleApp.LoggingExample">
              <!-- <appender-ref ref="B" /> -->
              <level value="ALL" />
              <appender-ref ref="RollingLogFileAppender" />
          </logger>
      </log4net>
  </configuration>
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Tutorials/ConsoleApp/cs/src/AssemblyInfo.cs
  
  Index: AssemblyInfo.cs
  ===================================================================
  #region Copyright
  // 
  // This framework is based on log4j see http://jakarta.apache.org/log4j
  // Copyright (C) The Apache Software Foundation. All rights reserved.
  //
  // This software is published under the terms of the Apache Software
  // License version 1.1, a copy of which has been included with this
  // distribution in the LICENSE.txt file.
  // 
  #endregion
  
  using System.Reflection;
  using System.Runtime.CompilerServices;
  
  //
  // General Information about an assembly is controlled through the following 
  // set of attributes. Change these attribute values to modify the information
  // associated with an assembly.
  //
  [assembly: AssemblyTitle("log4net - ConsoleApp")]
  [assembly: AssemblyDescription("log4net ConsoleApp")]
  [assembly: AssemblyConfiguration("")]
  [assembly: AssemblyCompany("Neoworks Limited")]
  [assembly: AssemblyProduct("log4net - TestApp")]
  [assembly: AssemblyCopyright("Copyright (C) 2001-2003 Neoworks Limited. All 
Rights Reserved.")]
  [assembly: AssemblyTrademark("Copyright (C) 2001-2003 Neoworks Limited. All 
Rights Reserved.")]
  [assembly: AssemblyCulture("")]               
  
  //
  // In order to sign your assembly you must specify a key to use. Refer to the 
  // Microsoft .NET Framework documentation for more information on assembly 
signing.
  //
  // Use the attributes below to control which key is used for signing. 
  //
  // Notes: 
  //   (*) If no key is specified, the assembly is not signed.
  //   (*) KeyName refers to a key that has been installed in the Crypto Service
  //       Provider (CSP) on your machine. KeyFile refers to a file which 
contains
  //       a key.
  //   (*) If the KeyFile and the KeyName values are both specified, the 
  //       following processing occurs:
  //       (1) If the KeyName can be found in the CSP, that key is used.
  //       (2) If the KeyName does not exist and the KeyFile does exist, the 
key 
  //           in the KeyFile is installed into the CSP and used.
  //   (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) 
utility.
  //       When specifying the KeyFile, the location of the KeyFile should be
  //       relative to the project output directory which is
  //       %Project Directory%\obj\<configuration>. For example, if your 
KeyFile is
  //       located in the project directory, you would specify the 
AssemblyKeyFile 
  //       attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
  //   (*) Delay Signing is an advanced option - see the Microsoft .NET 
Framework
  //       documentation for more information on this.
  //
  [assembly: AssemblyDelaySign(false)]
  [assembly: AssemblyKeyFile("")]
  [assembly: AssemblyKeyName("")]
  
  
  
  1.1                  
logging-log4net/examples/mono/1.0/Tutorials/ConsoleApp/cs/src/LoggingExample.cs
  
  Index: LoggingExample.cs
  ===================================================================
  #region Copyright
  // 
  // This framework is based on log4j see http://jakarta.apache.org/log4j
  // Copyright (C) The Apache Software Foundation. All rights reserved.
  //
  // This software is published under the terms of the Apache Software
  // License version 1.1, a copy of which has been included with this
  // distribution in the LICENSE.txt file.
  // 
  #endregion
  
  // Configure log4net using the .config file
  [assembly: log4net.Config.XmlConfigurator(Watch=true)]
  // This will cause log4net to look for a configuration file
  // called ConsoleApp.exe.config in the application base
  // directory (i.e. the directory containing ConsoleApp.exe)
  
  namespace ConsoleApp
  {
        using System;
  
        /// <summary>
        /// Example of how to simply configure and use log4net
        /// </summary>
        public class LoggingExample
        {
                // Create a logger for use in this class
                private static readonly log4net.ILog log = 
log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
                // NOTE that using 
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType
                // is equivalent to typeof(LoggingExample) but is more portable
                // i.e. you can copy the code directly into another class 
without
                // needing to edit the code.
  
                /// <summary>
                /// Application entry point
                /// </summary>
                /// <param name="args">command line arguments</param>
                public static void Main(string[] args)
                {
                        // Log an info level message
                        if (log.IsInfoEnabled) log.Info("Application 
[ConsoleApp] Start");
  
                        // Log a debug message. Test if debug is enabled before
                        // attempting to log the message. This is not required 
but
                        // can make running without logging faster.
                        if (log.IsDebugEnabled) log.Debug("This is a debug 
message");
  
                        try
                        {
                                Bar();
                        }
                        catch(Exception ex)
                        {
                                // Log an error with an exception
                                log.Error("Exception thrown from method Bar", 
ex);
                        }
  
                        log.Error("Hey this is an error!");
  
                        // Push a message on to the Nested Diagnostic Context 
stack
                        using(log4net.NDC.Push("NDC_Message"))
                        {
                                log.Warn("This should have an NDC message");
  
                                // Set a Mapped Diagnostic Context value  
                                log4net.MDC.Set("auth", "auth-none");
                                log.Warn("This should have an MDC message for 
the key 'auth'");
  
                        } // The NDC message is popped off the stack at the end 
of the using {} block
  
                        log.Warn("See the NDC has been popped of! The MDC 
'auth' key is still with us.");
  
                        // Log an info level message
                        if (log.IsInfoEnabled) log.Info("Application 
[ConsoleApp] End");
  
                        Console.Write("Press Enter to exit...");
                        Console.ReadLine();
                }
  
                // Helper methods to demonstrate location information and 
nested exceptions
  
                private static void Bar()
                {
                        Goo();
                }
  
                private static void Foo()
                {
                        throw new Exception("This is an Exception");
                }
  
                private static void Goo()
                {
                        try
                        {
                                Foo();
                        }
                        catch(Exception ex)
                        {
                                throw new ArithmeticException("Failed in Goo. 
Calling Foo. Inner Exception provided", ex);
                        }
                }
        }
  }
  
  
  

Reply via email to