nicko       2004/01/28 12:11:44

  Added:       examples/netcf/1.0 .cvsignore cs-examples.sln nant.build
                        nant.config vb-examples.sln
               examples/netcf/1.0/Tutorials nant.build nant.config
               examples/netcf/1.0/Tutorials/ConsoleApp nant.build
                        nant.config
               examples/netcf/1.0/Tutorials/ConsoleApp/cs .cvsignore
                        nant.build nant.config
               examples/netcf/1.0/Tutorials/ConsoleApp/cs/src .cvsignore
                        AssemblyInfo.cs ConsoleApp.csdproj
                        ConsoleApp.exe.config EntryPoint.cs
                        LoggingExample.cs
               examples/netcf/1.0/Tutorials/ConsoleApp/vb .cvsignore
                        nant.build nant.config
               examples/netcf/1.0/Tutorials/ConsoleApp/vb/src .cvsignore
                        AssemblyInfo.vb ConsoleApp.exe.config
                        ConsoleApp.vbdproj EntryPoint.vb LoggingExample.vb
  Log:
  Initial checkin
  
  Revision  Changes    Path
  1.1                  logging-log4net/examples/netcf/1.0/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  cs-examples.suo
  vb-examples.suo
  
  
  
  
  1.1                  logging-log4net/examples/netcf/1.0/cs-examples.sln
  
  Index: cs-examples.sln
  ===================================================================
  Microsoft Visual Studio Solution File, Format Version 8.00
  Project("{20D4826A-C6FA-45DB-90F4-C717570B9F32}") = "ConsoleApp", 
"Tutorials\ConsoleApp\cs\src\ConsoleApp.csdproj", 
"{06757B10-BBC2-4858-AB65-26F92D0D6A5D}"
        ProjectSection(ProjectDependencies) = postProject
        EndProjectSection
  EndProject
  Global
        GlobalSection(SolutionConfiguration) = preSolution
                Debug = Debug
                Release = Release
        EndGlobalSection
        GlobalSection(ProjectConfiguration) = postSolution
                {06757B10-BBC2-4858-AB65-26F92D0D6A5D}.Debug.ActiveCfg = 
Debug|Windows CE
                {06757B10-BBC2-4858-AB65-26F92D0D6A5D}.Debug.Build.0 = 
Debug|Windows CE
                {06757B10-BBC2-4858-AB65-26F92D0D6A5D}.Debug.Deploy.0 = 
Debug|Windows CE
                {06757B10-BBC2-4858-AB65-26F92D0D6A5D}.Release.ActiveCfg = 
Release|Windows CE
                {06757B10-BBC2-4858-AB65-26F92D0D6A5D}.Release.Build.0 = 
Release|Windows CE
                {06757B10-BBC2-4858-AB65-26F92D0D6A5D}.Release.Deploy.0 = 
Release|Windows CE
        EndGlobalSection
        GlobalSection(ExtensibilityGlobals) = postSolution
        EndGlobalSection
        GlobalSection(ExtensibilityAddIns) = postSolution
        EndGlobalSection
  EndGlobal
  
  
  
  1.1                  logging-log4net/examples/netcf/1.0/nant.build
  
  Index: nant.build
  ===================================================================
  <?xml version="1.0" ?>
  <project name="netcf-1.0-examples" default="compile" 
xmlnds="http://tempuri.org/nant-vs.xsd";>
      <!-- include configuration file -->
      <include buildfile="nant.config" />
      <!-- compile all .NET Compact Framework 1.0 examples -->
      <target name="compile" description="Builds .NET Compact Framework 1.0 
examples">
          <available type="Framework" 
resource="${project.runtime.config}-${project.runtime.version}"
              property="temp.framework.available" />
          <if propertytrue="temp.framework.available">
              <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/netcf/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=".NET Compact 
Framework 1.0" readonly="false" />
  </project>
  
  
  
  1.1                  logging-log4net/examples/netcf/1.0/vb-examples.sln
  
  Index: vb-examples.sln
  ===================================================================
  Microsoft Visual Studio Solution File, Format Version 8.00
  Project("{CB4CE8C6-1BDB-4DC7-A4D3-65A1999772F8}") = "ConsoleApp", 
"Tutorials\ConsoleApp\vb\src\ConsoleApp.vbdproj", 
"{E923C49B-5C5F-49A3-AFE1-7DDB2EC31757}"
        ProjectSection(ProjectDependencies) = postProject
        EndProjectSection
  EndProject
  Global
        GlobalSection(SolutionConfiguration) = preSolution
                Debug = Debug
                Release = Release
        EndGlobalSection
        GlobalSection(ProjectConfiguration) = postSolution
                {E923C49B-5C5F-49A3-AFE1-7DDB2EC31757}.Debug.ActiveCfg = 
Debug|Windows CE
                {E923C49B-5C5F-49A3-AFE1-7DDB2EC31757}.Debug.Build.0 = 
Debug|Windows CE
                {E923C49B-5C5F-49A3-AFE1-7DDB2EC31757}.Debug.Deploy.0 = 
Debug|Windows CE
                {E923C49B-5C5F-49A3-AFE1-7DDB2EC31757}.Release.ActiveCfg = 
Release|Windows CE
                {E923C49B-5C5F-49A3-AFE1-7DDB2EC31757}.Release.Build.0 = 
Release|Windows CE
                {E923C49B-5C5F-49A3-AFE1-7DDB2EC31757}.Release.Deploy.0 = 
Release|Windows CE
        EndGlobalSection
        GlobalSection(ExtensibilityGlobals) = postSolution
        EndGlobalSection
        GlobalSection(ExtensibilityAddIns) = postSolution
        EndGlobalSection
  EndGlobal
  
  
  
  1.1                  logging-log4net/examples/netcf/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/netcf/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/netcf/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" />
          <nant buildfile="vb/nant.build" target="compile" />
      </target>
  </project>
  
  
  
  1.1                  
logging-log4net/examples/netcf/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/netcf/1.0/Tutorials/ConsoleApp/cs/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  bin
  doc
  build
  
  
  
  
  1.1                  
logging-log4net/examples/netcf/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 target="exe" warnaserror="true" 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="mscorlib.dll" fromPath="false" />
                  <includes name="System.dll" fromPath="false" />
                  <includes name="${current.bin.dir}/log4net.dll" 
frompath="false" />
              </references>
          </csc>
          <!-- copy the ConsoleApp application configuration file -->
          <copy file="src/ConsoleApp.exe.config" todir="${current.bin.dir}" />
      </target>
  </project>
  
  
  
  1.1                  
logging-log4net/examples/netcf/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/netcf/1.0/Tutorials/ConsoleApp/cs/src/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  obj
  ConsoleApp.sln
  ConsoleApp.suo
  ConsoleApp.csdproj.user
  
  
  
  
  1.1                  
logging-log4net/examples/netcf/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/netcf/1.0/Tutorials/ConsoleApp/cs/src/ConsoleApp.csdproj
  
  Index: ConsoleApp.csdproj
  ===================================================================
  <VisualStudioProject>
      <ECSHARP
          ProjectType = "Local"
          ProductVersion = "7.10.3077"
          SchemaVersion = "1.0"
          ProjectGuid = "{06757B10-BBC2-4858-AB65-26F92D0D6A5D}"
      >
          <Build>
              <Settings
                  ApplicationIcon = ""
                  AssemblyKeyContainerName = ""
                  AssemblyName = "ConsoleApp"
                  AssemblyOriginatorKeyFile = ""
                  DelaySign = "false"
                  OutputType = "Exe"
                  OutputFileFolder = "\Program Files\ConsoleAppCS"
                  RootNamespace = "ConsoleApp"
                  StartupObject = ""
              >
                  <Platform Name = "Windows CE" />
                  <Config
                      Name = "Debug|Windows CE"
                      AllowUnsafeBlocks = "false"
                      BaseAddress = "0"
                      CheckForOverflowUnderflow = "false"
                      ConfigurationOverrideFile = ""
                      DefineConstants = "DEBUG;TRACE"
                      DocumentationFile = ""
                      DebugSymbols = "true"
                      FileAlignment = "4096"
                      IncrementalBuild = "false"
                      Optimize = "false"
                      OutputPath = "..\build\netcf\1.0\debug\"
                      RegisterForComInterop = "false"
                      RemoveIntegerChecks = "false"
                      TreatWarningsAsErrors = "false"
                      WarningLevel = "4"
                  />
                  <Config
                      Name = "Release|Windows CE"
                      AllowUnsafeBlocks = "false"
                      BaseAddress = "0"
                      CheckForOverflowUnderflow = "false"
                      ConfigurationOverrideFile = ""
                      DefineConstants = "TRACE"
                      DocumentationFile = ""
                      DebugSymbols = "false"
                      FileAlignment = "4096"
                      IncrementalBuild = "false"
                      Optimize = "true"
                      OutputPath = "..\build\netcf\1.0\release\"
                      RegisterForComInterop = "false"
                      RemoveIntegerChecks = "false"
                      TreatWarningsAsErrors = "false"
                      WarningLevel = "4"
                  />
              </Settings>
              <References>
                  <Reference
                      Platform = "Windows CE"
                      Name = "MSCorLib"
                      AssemblyName = "mscorlib"
                      Private = "False"
                  />
                  <Reference
                      Platform = "Windows CE"
                      Name = "log4net"
                      AssemblyName = "log4net"
                  />
                  <Reference
                      Platform = "Windows CE-Designer"
                      Name = "System.CF.Design"
                      AssemblyName = "System.CF.Design"
                      Private = "False"
                  />
                  <Reference
                      Platform = "Windows CE-Designer"
                      Name = "System.CF.Design.UI"
                      AssemblyName = "System.CF.Design.UI"
                      Private = "False"
                  />
                  <Reference
                      Platform = "Windows CE-Designer"
                      Name = "System.CF.Windows.Forms"
                      AssemblyName = "System.CF.Windows.Forms"
                      Private = "False"
                  />
                  <Reference
                      Platform = "Windows CE-Designer"
                      Name = "System.CF.Drawing"
                      AssemblyName = "System.CF.Drawing"
                      Private = "False"
                  />
                  <Reference
                      Platform = "Windows CE-Designer"
                      Name = "System"
                      AssemblyName = "System"
                      Private = "False"
                  />
              </References>
          </Build>
          <Files>
              <Include>
                  <File
                      RelPath = "AssemblyInfo.cs"
                      SubType = "Code"
                      BuildAction = "Compile"
                  />
                  <File
                      RelPath = "AssemblyVersionInfo.cs"
                      Link = "..\..\..\..\..\..\..\src\AssemblyVersionInfo.cs"
                      SubType = "Code"
                      BuildAction = "Compile"
                  />
                  <File
                      RelPath = "ConsoleApp.exe.config"
                      BuildAction = "Content"
                  />
                  <File
                      RelPath = "EntryPoint.cs"
                      SubType = "Code"
                      BuildAction = "Compile"
                  />
                  <File
                      RelPath = "LoggingExample.cs"
                      SubType = "Code"
                      BuildAction = "Compile"
                  />
              </Include>
          </Files>
      </ECSHARP>
  </VisualStudioProject>
  
  
  
  
  1.1                  
logging-log4net/examples/netcf/1.0/Tutorials/ConsoleApp/cs/src/ConsoleApp.exe.config
  
  Index: ConsoleApp.exe.config
  ===================================================================
  <?xml version="1.0" encoding="utf-8" ?>
  
  <!-- .NET application configuration file
  
       The .NET Compact Framework does not support application configuration 
files,
       but log4net supports using configuration files with similar names and 
structure,
       to store the log4net configuration.
   -->
  
  <configuration>
        <!-- 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="MulticastAppender" 
type="log4net.Appender.UdpAppender" >
                        <param name="Threshold" value="WARN" />
                        <param name="RemoteAddress" value="224.0.0.1" />
                        <param name="RemotePort" value="8080" />
                        <layout type="log4net.Layout.PatternLayout">
                                <param name="ConversionPattern" value="%d [%t] 
%-5p %c [%x] - %m%n" />
                        </layout>
                </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>
                
                <!-- 
                
                <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> 
                
                -->
  
                <!-- Setup the root category, add the appenders and set the 
default level -->
                
                <root>
                        <level value="INFO" />
                        <appender-ref ref="LogFileAppender" />
                        <appender-ref ref="ConsoleAppender" />
                        <appender-ref ref="MulticastAppender" />
                        <!-- <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/netcf/1.0/Tutorials/ConsoleApp/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
  
  namespace ConsoleApp
  {
        using System;
  
        using log4net;
  
        /// <summary>
        /// Example of how to simply configure and use log4net in a .NET 
Compact Framework
        /// application.
        /// </summary>
        /// <remarks>
        /// <para>
        /// The .NET Compact Framework does not support retrieving 
assembly-level
        /// attributes, therefor log4net must be configured by code.
        /// </para>
        /// <para>
        /// The .NET Compact Framework does not support hooking up the 
<c>AppDomain.ProcessExit</c>
        /// and <c>AppDomain.DomainUnload</c> events, so log4net must be 
shutdown manually to 
        /// free all resources.
        /// </para>
        /// </remarks>
        public class EntryPoint
        {
                /// <summary>
                /// Application entry point.
                /// </summary>
                public static void Main() 
                {
                        // Uncomment the next line to enable log4net internal 
debugging
                        // log4net.helpers.LogLog.InternalDebugging = true;
  
                        // This will instruct log4net to look for a 
configuration file
                        // called ConsoleApp.exe.config in the application base
                        // directory (i.e. the directory containing 
ConsoleApp.exe)
                        log4net.Config.XmlConfigurator.Configure();
  
                        // Create a logger
                        ILog log = LogManager.GetLogger(typeof(EntryPoint));
  
                        // Log an info level message
                        if (log.IsInfoEnabled) log.Info("Application 
[ConsoleApp] Start");
  
                        // Invoke static LogEvents method on LoggingExample 
class
                        LoggingExample.LogEvents(); 
  
                        Console.Write("Press Enter to exit...");
                        Console.ReadLine();
  
                        if (log.IsInfoEnabled) log.Info("Application 
[ConsoleApp] Stop");
  
                        // It's not possible to use shutdown hooks in the .NET 
Compact Framework,
                        // so you have manually shutdown log4net to free all 
resoures.
                        LogManager.Shutdown();
                }
        }
  }
  
  
  
  1.1                  
logging-log4net/examples/netcf/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
  
  namespace ConsoleApp
  {
        using System;
  
        /// <summary>
        /// Illustrates using log4net to conditionally log events, and 
        /// using log4net to log exceptions, ...
        /// </summary>
        public class LoggingExample
        {
                // Create a logger for use in this class
                private static readonly log4net.ILog log = 
log4net.LogManager.GetLogger(typeof(LoggingExample));
  
                /// <summary>
                /// Logs events.
                /// </summary>
                public static void LogEvents()
                {
                        // 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.");
                }
  
                // 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);
                        }
                }
        }
  }
  
  
  
  1.1                  
logging-log4net/examples/netcf/1.0/Tutorials/ConsoleApp/vb/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  bin
  doc
  build
  
  
  
  
  1.1                  
logging-log4net/examples/netcf/1.0/Tutorials/ConsoleApp/vb/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 -->
          <vbc target="exe" warnaserror="true" debug="${current.build.debug}" 
define="${current.build.defines.vbc}"
              output="${current.bin.dir}/ConsoleApp.exe">
              <arg value="/netcf" />
              <arg 
value="/sdkpath:${nant.settings.currentframework.frameworkassemblydirectory}" />
              <sources defaultexcludes="true">
                  <includes name="src/**/*.vb" />
                  <includes 
name="${log4net.basedir}/src/AssemblyVersionInfo.vb" />
              </sources>
              <references defaultexcludes="true">
                  <includes name="System.dll" fromPath="false" />
                  <includes name="${current.bin.dir}/log4net.dll" 
frompath="false" />
              </references>
          </vbc>
          <!-- copy the ConsoleApp application configuration file -->
          <copy file="src/ConsoleApp.exe.config" todir="${current.bin.dir}" />
      </target>
  </project>
  
  
  
  1.1                  
logging-log4net/examples/netcf/1.0/Tutorials/ConsoleApp/vb/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/netcf/1.0/Tutorials/ConsoleApp/vb/src/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  obj
  ConsoleApp.sln
  ConsoleApp.suo
  ConsoleApp.vbdproj.user
  
  
  
  
  1.1                  
logging-log4net/examples/netcf/1.0/Tutorials/ConsoleApp/vb/src/AssemblyInfo.vb
  
  Index: AssemblyInfo.vb
  ===================================================================
  #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.
  '
  #End Region 
  
  Imports System.Reflection
  Imports 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 - 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("")>
  <Assembly:AssemblyKeyName("")>
  
  
  
  1.1                  
logging-log4net/examples/netcf/1.0/Tutorials/ConsoleApp/vb/src/ConsoleApp.exe.config
  
  Index: ConsoleApp.exe.config
  ===================================================================
  <?xml version="1.0" encoding="utf-8" ?>
  
  <!-- .NET application configuration file
  
       The .NET Compact Framework does not support application configuration 
files,
       but log4net supports using configuration files with similar names and 
structure,
       to store the log4net configuration.
   -->
  
  <configuration>
        <!-- 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="MulticastAppender" 
type="log4net.Appender.UdpAppender" >
                        <param name="Threshold" value="WARN" />
                        <param name="RemoteAddress" value="224.0.0.1" />
                        <param name="RemotePort" value="8080" />
                        <layout type="log4net.Layout.PatternLayout">
                                <param name="ConversionPattern" value="%d [%t] 
%-5p %c [%x] - %m%n" />
                        </layout>
                </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>
                
                <!-- 
                
                <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> 
                
                -->
  
                <!-- Setup the root category, add the appenders and set the 
default level -->
                
                <root>
                        <level value="INFO" />
                        <appender-ref ref="LogFileAppender" />
                        <appender-ref ref="ConsoleAppender" />
                        <appender-ref ref="MulticastAppender" />
                        <!-- <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/netcf/1.0/Tutorials/ConsoleApp/vb/src/ConsoleApp.vbdproj
  
  Index: ConsoleApp.vbdproj
  ===================================================================
  <VisualStudioProject>
      <EVisualBasic
          ProjectType = "Local"
          ProductVersion = "7.10.3077"
          SchemaVersion = "1.0"
          ProjectGuid = "{E923C49B-5C5F-49A3-AFE1-7DDB2EC31757}"
      >
          <Build>
              <Settings
                  ApplicationIcon = ""
                  AssemblyKeyContainerName = ""
                  AssemblyName = "ConsoleApp"
                  AssemblyOriginatorKeyFile = ""
                  AssemblyOriginatorKeyMode = "None"
                  DelaySign = "false"
                  OutputType = "Exe"
                  OptionCompare = "Binary"
                  OptionExplicit = "On"
                  OptionStrict = "Off"
                  OutputFileFolder = "\Program Files\ConsoleAppVB"
                  RootNamespace = "ConsoleApp"
                  StartupObject = ""
              >
                  <Platform Name = "Windows CE" />
                  <Config
                      Name = "Debug|Windows CE"
                      BaseAddress = "0"
                      ConfigurationOverrideFile = ""
                      DefineConstants = ""
                      DefineDebug = "true"
                      DefineTrace = "true"
                      DebugSymbols = "true"
                      IncrementalBuild = "false"
                      Optimize = "false"
                      OutputPath = "..\build\netcf\1.0\debug\"
                      RegisterForComInterop = "false"
                      RemoveIntegerChecks = "false"
                      TreatWarningsAsErrors = "false"
                      WarningLevel = "1"
                  />
                  <Config
                      Name = "Release|Windows CE"
                      BaseAddress = "0"
                      ConfigurationOverrideFile = ""
                      DefineConstants = ""
                      DefineDebug = "false"
                      DefineTrace = "true"
                      DebugSymbols = "false"
                      IncrementalBuild = "false"
                      Optimize = "false"
                      OutputPath = "..\build\netcf\1.0\release\"
                      RegisterForComInterop = "false"
                      RemoveIntegerChecks = "false"
                      TreatWarningsAsErrors = "false"
                      WarningLevel = "1"
                  />
              </Settings>
              <References>
                  <Reference
                      Platform = "Windows CE"
                      Name = "log4net"
                      AssemblyName = "log4net"
                  />
                  <Reference
                      Platform = "Windows CE-Designer"
                      Name = "System.CF.Design"
                      AssemblyName = "System.CF.Design"
                      Private = "False"
                  />
                  <Reference
                      Platform = "Windows CE-Designer"
                      Name = "System.CF.Design.UI"
                      AssemblyName = "System.CF.Design.UI"
                      Private = "False"
                  />
                  <Reference
                      Platform = "Windows CE-Designer"
                      Name = "System.CF.Windows.Forms"
                      AssemblyName = "System.CF.Windows.Forms"
                      Private = "False"
                  />
                  <Reference
                      Platform = "Windows CE-Designer"
                      Name = "System.CF.Drawing"
                      AssemblyName = "System.CF.Drawing"
                      Private = "False"
                  />
                  <Reference
                      Platform = "Windows CE-Designer"
                      Name = "System"
                      AssemblyName = "System"
                      Private = "False"
                  />
              </References>
              <Imports>
                  <Import Namespace = "Microsoft.VisualBasic" />
                  <Import Namespace = "System" />
                  <Import Namespace = "System.Collections" />
                  <Import Namespace = "System.Configuration" />
                  <Import Namespace = "System.Diagnostics" />
              </Imports>
          </Build>
          <Files>
              <Include>
                  <File
                      RelPath = "AssemblyInfo.vb"
                      SubType = "Code"
                      BuildAction = "Compile"
                  />
                  <File
                      RelPath = "AssemblyVersionInfo.vb"
                      Link = "..\..\..\..\..\..\..\src\AssemblyVersionInfo.vb"
                      SubType = "Code"
                      BuildAction = "Compile"
                  />
                  <File
                      RelPath = "ConsoleApp.exe.config"
                      BuildAction = "Content"
                  />
                  <File
                      RelPath = "EntryPoint.vb"
                      SubType = "Code"
                      BuildAction = "Compile"
                  />
                  <File
                      RelPath = "LoggingExample.vb"
                      SubType = "Code"
                      BuildAction = "Compile"
                  />
              </Include>
          </Files>
      </EVisualBasic>
  </VisualStudioProject>
  
  
  
  
  1.1                  
logging-log4net/examples/netcf/1.0/Tutorials/ConsoleApp/vb/src/EntryPoint.vb
  
  Index: EntryPoint.vb
  ===================================================================
  #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.
  ' 
  #End Region
  
  Imports System
  
  Imports log4net
  
  Namespace ConsoleApp
        ' Example of how to simply configure and use log4net in a .NET Compact 
Framework
        ' application.
        '
        ' The .NET Compact Framework does not support retrieving assembly-level
        ' attributes, therefor log4net must be configured by code.
        '
        ' The .NET Compact Framework does not support hooking up the 
<c>AppDomain.ProcessExit</c>
        ' and <c>AppDomain.DomainUnload</c> events, so log4net must be shutdown 
manually to 
        ' free all resources.
        Public Class EntryPoint
                ' Application entry point.
                Public Shared Sub Main() 
                        ' Uncomment the next line to enable log4net internal 
debugging
                        ' log4net.helpers.LogLog.InternalDebugging = true;
  
                        ' This will instruct log4net to look for a 
configuration file
                        ' called ConsoleApp.exe.config in the application base
                        ' directory (i.e. the directory containing 
ConsoleApp.exe)
                        log4net.Config.XmlConfigurator.Configure()
  
                        ' Create a logger
                        Dim log As ILog = 
LogManager.GetLogger(GetType(EntryPoint))
  
                        ' Log an info level message
                        If log.IsInfoEnabled Then log.Info("Application 
[ConsoleApp] Start")
  
                        ' Invoke shared LogEvents method on LoggingExample class
                        LoggingExample.LogEvents()
  
                        Console.Write("Press Enter to exit...")
                        Console.ReadLine()
  
                        If log.IsInfoEnabled Then log.Info("Application 
[ConsoleApp] Stop")
  
                        ' It's not possible to use shutdown hooks in the .NET 
Compact Framework,
                        ' so you have manually shutdown log4net to free all 
resoures.
                        LogManager.Shutdown()
                End Sub
        End Class
  End Namespace
  
  
  
  1.1                  
logging-log4net/examples/netcf/1.0/Tutorials/ConsoleApp/vb/src/LoggingExample.vb
  
  Index: LoggingExample.vb
  ===================================================================
  #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.
  ' 
  #End Region
  
  Imports System
  
  Namespace ConsoleApp
        ' Illustrates using log4net to conditionally log events, and 
        ' using log4net to log exceptions, ...
        Public Class LoggingExample
                ' Create a logger for use in this class
                Private Shared ReadOnly log As log4net.ILog = 
log4net.LogManager.GetLogger(GetType(LoggingExample))
  
                ' Logs events.
                Public Shared Sub LogEvents()
                        ' 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 Then log.Debug("This is a debug 
message")
  
                        Try
                                Bar()
                        Catch ex As Exception
                                ' Log an error with an exception
                                log.Error("Exception thrown from method Bar", 
ex)
                        End Try
  
                        log.Error("Hey this is an error!")
  
                        Dim disposableFrame As IDisposable
  
                        Try
                                ' Push a message on to the Nested Diagnostic 
Context stack
                                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 (Not disposableFrame is Nothing) Then 
disposableFrame.Dispose()
                        End Try
  
                        log.Warn("See the NDC has been popped of! The MDC 
'auth' key is still with us.")
                End Sub
  
                ' Helper methods to demonstrate location information and nested 
exceptions
  
                Private Shared Sub Bar()
                        Goo()
                End Sub
  
                Private Shared Sub Foo()
                        Throw New Exception("This is an Exception")
                End Sub
  
                Private Shared Sub Goo()
                        Try
                                Foo()
                        Catch ex As Exception
                                Throw New ArithmeticException("Failed in Goo. 
Calling Foo. Inner Exception provided", ex)
                        End Try
                End Sub
        End Class
  End Namespace
  
  
  

Reply via email to