nicko       2004/01/28 12:08:21

  Added:       examples/sscli/1.0 nant.build nant.config
               examples/sscli/1.0/Repository nant.build nant.config
               examples/sscli/1.0/Repository/SharedModule nant.build
                        nant.config
               examples/sscli/1.0/Repository/SharedModule/cs .cvsignore
                        nant.build nant.config
               examples/sscli/1.0/Repository/SharedModule/cs/src
                        AssemblyInfo.cs Math.cs
               examples/sscli/1.0/Repository/SimpleApp nant.build
                        nant.config
               examples/sscli/1.0/Repository/SimpleApp/cs .cvsignore
                        nant.build nant.config
               examples/sscli/1.0/Repository/SimpleApp/cs/src App.config
                        AssemblyInfo.cs EntryPoint.cs SimpleApp.exe.log4net
               examples/sscli/1.0/Repository/SimpleModule nant.build
                        nant.config
               examples/sscli/1.0/Repository/SimpleModule/cs .cvsignore
                        nant.build nant.config
               examples/sscli/1.0/Repository/SimpleModule/cs/src
                        AssemblyInfo.cs Math.cs SimpleModule.dll.log4net
               examples/sscli/1.0/Tutorials nant.build nant.config
               examples/sscli/1.0/Tutorials/ConsoleApp nant.build
                        nant.config
               examples/sscli/1.0/Tutorials/ConsoleApp/js .cvsignore
                        nant.build nant.config
               examples/sscli/1.0/Tutorials/ConsoleApp/js/src App.config
                        AssemblyInfo.js LoggingExample.js
  Log:
  Initial checkin
  
  Revision  Changes    Path
  1.1                  logging-log4net/examples/sscli/1.0/nant.build
  
  Index: nant.build
  ===================================================================
  <?xml version="1.0" ?>
  <project name="sscli-examples" default="compile" 
xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- include configuration file -->
      <include buildfile="nant.config" />
      <!-- compile all examples -->
      <target name="compile" description="Builds Shared Source CLI 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="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>
      </target>
  </project>
  
  
  
  1.1                  logging-log4net/examples/sscli/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="Shared Source CLI 
1.0" readonly="false" />
  </project>
  
  
  
  1.1                  logging-log4net/examples/sscli/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/sscli/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/sscli/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/sscli/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/sscli/1.0/Repository/SharedModule/cs/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  bin
  doc
  
  
  
  
  1.1                  
logging-log4net/examples/sscli/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/sscli/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/sscli/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("")]
  
  
  
  1.1                  
logging-log4net/examples/sscli/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/sscli/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/sscli/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/sscli/1.0/Repository/SimpleApp/cs/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  bin
  doc
  
  
  
  
  1.1                  
logging-log4net/examples/sscli/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/sscli/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/sscli/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/sscli/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("")]
  
  
  
  1.1                  
logging-log4net/examples/sscli/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")]
  
  // 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>
                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/sscli/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/sscli/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/sscli/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/sscli/1.0/Repository/SimpleModule/cs/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  bin
  doc
  
  
  
  
  1.1                  
logging-log4net/examples/sscli/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/sscli/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/sscli/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("")]
  
  
  
  1.1                  
logging-log4net/examples/sscli/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")]
  
  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/sscli/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/sscli/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/sscli/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/sscli/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="js/nant.build" target="compile" />
      </target>
  </project>
  
  
  
  1.1                  
logging-log4net/examples/sscli/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/sscli/1.0/Tutorials/ConsoleApp/js/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  bin
  doc
  build
  
  
  
  
  1.1                  
logging-log4net/examples/sscli/1.0/Tutorials/ConsoleApp/js/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 -->
          <jsc target="exe" warnaserror="true" debug="${current.build.debug}" 
define="${current.build.defines.jsc}"
              output="${current.bin.dir}/ConsoleApp.exe">
              <sources defaultexcludes="true">
                  <includes name="src/**/*.js" />
                  <includes 
name="${log4net.basedir}/src/AssemblyVersionInfo.js" />
              </sources>
              <references basedir="${current.bin.dir}" defaultexcludes="true">
                  <includes name="log4net.dll" frompath="false" />
              </references>
          </jsc>
          <!-- 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/sscli/1.0/Tutorials/ConsoleApp/js/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/sscli/1.0/Tutorials/ConsoleApp/js/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 must also be in the same directory as the application. 
        -->
  <configuration>
        <!-- Register the section handler for the log4net section -->
        <configSections>
                <section name="log4net" 
type="System.Configuration.IgnoreSectionHandler" />
        </configSections>
        <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>
                <!-- Setup the root category, add the appenders and set the 
default level -->
                <root>
                        <level value="WARN" />
                        <appender-ref ref="LogFileAppender" />
                        <appender-ref ref="ConsoleAppender" />
                </root>
                <!-- Specify the level for some specific categories -->
                <logger name="ConsoleApp.LoggingExample">
                        <level value="ALL" />
                        <appender-ref ref="RollingLogFileAppender" />
                </logger>
        </log4net>
  </configuration>
  
  
  1.1                  
logging-log4net/examples/sscli/1.0/Tutorials/ConsoleApp/js/src/AssemblyInfo.js
  
  Index: AssemblyInfo.js
  ===================================================================
  // 
  // 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.
  //
  
  import System.Reflection;
  import System.Runtime.CompilerServices;
  
  [assembly: System.CLSCompliant(true)]
  
  //
  // 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 - ConsoleApp")]
  [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("")]
  // We do not use a CSP key for strong naming
  // [assembly: AssemblyKeyName("")]
  
  
  
  1.1                  
logging-log4net/examples/sscli/1.0/Tutorials/ConsoleApp/js/src/LoggingExample.js
  
  Index: LoggingExample.js
  ===================================================================
  // 
  // 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.
  // 
  
  // JScript.NET does not support application entry points (like vb.Net and 
C#), 
  // instead it supports global code.
  ConsoleApp.LoggingExample.Main();
  
  import System;
  
  import log4net;
  
  // Configure log4net using the .config file
  [assembly:log4net.Config.XmlConfigurator()]
  // 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)
  
  package ConsoleApp {
        // Example of how to simply configure and use log4net
        public class LoggingExample {
                // Create a logger for use in this class
                private static var log : log4net.ILog = 
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.
  
                // Application entry point
                public static function Main() {
                        // 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 (ex : Exception) {
                                // Log an error with an exception
                                log.Error("Exception thrown from method Bar", 
ex);
                        }
  
                        log.Error("Hey this is an error!");
  
                        var disposableFrame : IDisposable;
  
                        try {
                                // Push a message on to the Nested Diagnostic 
Context stack
                                disposableFrame = 
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'");
                        } finally {
                                // The NDC message is popped off the stack by 
using the Dispose method
                                if (disposableFrame != null) 
disposableFrame.Dispose();
                        }
  
                        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 function Bar() {
                        Goo();
                }
  
                private static function Foo() {
                        throw new Exception("This is an Exception");
                }
  
                private static function Goo() {
                        try {
                                Foo();
                        } catch (ex : Exception) {
                                throw new ArithmeticException("Failed in Goo. 
Calling Foo. Inner Exception provided", ex);
                        }
                }
        }
  }
  
  
  

Reply via email to