nicko       2005/08/29 08:25:46

  Modified:    examples/net/1.0 cs-examples.sln
               xdocs/src/release example-apps.xml
  Added:       examples/net/1.0/Layouts nant.build nant.config
               examples/net/1.0/Layouts/SampleLayoutsApp nant.build
                        nant.config
               examples/net/1.0/Layouts/SampleLayoutsApp/cs .cvsignore
                        nant.build nant.config
               examples/net/1.0/Layouts/SampleLayoutsApp/cs/src .cvsignore
                        App.config AssemblyInfo.cs LoggingExample.cs
                        SampleLayoutsApp.csproj
               examples/net/1.0/Layouts/SampleLayoutsApp/cs/src/Layout
                        ForwardingLayout.cs LineWrappingLayout.cs
  Log:
  Fix for LOG4NET-17. Added Layouts sample project with line wrapping layout
  
  Revision  Changes    Path
  1.2       +12 -0     logging-log4net/examples/net/1.0/cs-examples.sln
  
  Index: cs-examples.sln
  ===================================================================
  RCS file: /home/cvs/logging-log4net/examples/net/1.0/cs-examples.sln,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- cs-examples.sln   28 Jan 2004 20:38:35 -0000      1.1
  +++ cs-examples.sln   29 Aug 2005 15:25:45 -0000      1.2
  @@ -21,6 +21,10 @@
   EndProject

   Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventIDLogApp", 
"Extensibility\EventIDLogApp\cs\src\EventIDLogApp.csproj", 
"{B3DCF964-EAC8-46F2-AA11-151713141536}"

   EndProject

  +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleAppendersApp", 
"Appenders\SampleAppendersApp\cs\src\SampleAppendersApp.csproj", 
"{9E715F72-7F70-421B-A2BF-E9CB42F88F5C}"

  +EndProject

  +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleLayoutsApp", 
"Layouts\SampleLayoutsApp\cs\src\SampleLayoutsApp.csproj", 
"{CD7A8094-D383-46BC-A75D-9F65F746E24F}"

  +EndProject

   Global

        GlobalSection(SolutionConfiguration) = preSolution

                ConfigName.0 = Debug

  @@ -73,6 +77,14 @@
                {B3DCF964-EAC8-46F2-AA11-151713141536}.Debug.Build.0 = 
Debug|.NET

                {B3DCF964-EAC8-46F2-AA11-151713141536}.Release.ActiveCfg = 
Release|.NET

                {B3DCF964-EAC8-46F2-AA11-151713141536}.Release.Build.0 = 
Release|.NET

  +             {9E715F72-7F70-421B-A2BF-E9CB42F88F5C}.Debug.ActiveCfg = 
Debug|.NET

  +             {9E715F72-7F70-421B-A2BF-E9CB42F88F5C}.Debug.Build.0 = 
Debug|.NET

  +             {9E715F72-7F70-421B-A2BF-E9CB42F88F5C}.Release.ActiveCfg = 
Release|.NET

  +             {9E715F72-7F70-421B-A2BF-E9CB42F88F5C}.Release.Build.0 = 
Release|.NET

  +             {CD7A8094-D383-46BC-A75D-9F65F746E24F}.Debug.ActiveCfg = 
Debug|.NET

  +             {CD7A8094-D383-46BC-A75D-9F65F746E24F}.Debug.Build.0 = 
Debug|.NET

  +             {CD7A8094-D383-46BC-A75D-9F65F746E24F}.Release.ActiveCfg = 
Release|.NET

  +             {CD7A8094-D383-46BC-A75D-9F65F746E24F}.Release.Build.0 = 
Release|.NET

        EndGlobalSection

        GlobalSection(ExtensibilityGlobals) = postSolution

        EndGlobalSection

  
  
  
  1.1                  logging-log4net/examples/net/1.0/Layouts/nant.build
  
  Index: nant.build
  ===================================================================
  <?xml version="1.0" ?>

  <!--

  Copyright 2004-2005 The Apache Software Foundation

  

  Licensed under the Apache License, Version 2.0 (the "License");

  you may not use this file except in compliance with the License.

  You may obtain a copy of the License at

  

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

  

  Unless required by applicable law or agreed to in writing, software

  distributed under the License is distributed on an "AS IS" BASIS,

  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  See the License for the specific language governing permissions and

  limitations under the License.

  -->

  <project name="layout-examples" default="compile" 
xmlnds="http://tempuri.org/nant-vs.xsd";>

      <!-- compile Tutorials examples -->

      <target name="compile" description="Builds Layout examples">

          <nant target="compile">

              <buildfiles>

                  <include name="*/nant.build" />

                  <!-- exclude current build file -->

                  <exclude name="exclude.build" />

              </buildfiles>

          </nant>

      </target>

  </project>

  
  
  
  1.1                  logging-log4net/examples/net/1.0/Layouts/nant.config
  
  Index: nant.config
  ===================================================================
  <?xml version="1.0" ?>

  <!--

  Copyright 2004-2005 The Apache Software Foundation

  

  Licensed under the Apache License, Version 2.0 (the "License");

  you may not use this file except in compliance with the License.

  You may obtain a copy of the License at

  

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

  

  Unless required by applicable law or agreed to in writing, software

  distributed under the License is distributed on an "AS IS" BASIS,

  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  See the License for the specific language governing permissions and

  limitations under the License.

  -->

  <project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd";>

      <!-- Include parent configuration file -->

      <include buildfile="../nant.config" />

  </project>

  
  
  
  1.1                  
logging-log4net/examples/net/1.0/Layouts/SampleLayoutsApp/nant.build
  
  Index: nant.build
  ===================================================================
  <?xml version="1.0" ?>

  <!--

  Copyright 2004-2005 The Apache Software Foundation

  

  Licensed under the Apache License, Version 2.0 (the "License");

  you may not use this file except in compliance with the License.

  You may obtain a copy of the License at

  

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

  

  Unless required by applicable law or agreed to in writing, software

  distributed under the License is distributed on an "AS IS" BASIS,

  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  See the License for the specific language governing permissions and

  limitations under the License.

  -->

  <project name="samplelayoutssapp-example" default="compile" 
xmlnds="http://tempuri.org/nant-vs.xsd";>

      <!-- compile ConsoleApp example -->

      <target name="compile" description="Builds SampleLayoutsApp example">

          <nant target="compile">

              <buildfiles>

                  <include name="*/nant.build" />

                  <!-- exclude current build file -->

                  <exclude name="exclude.build" />

              </buildfiles>

          </nant>

      </target>

  </project>

  
  
  
  1.1                  
logging-log4net/examples/net/1.0/Layouts/SampleLayoutsApp/nant.config
  
  Index: nant.config
  ===================================================================
  <?xml version="1.0" ?>

  <!--

  Copyright 2004-2005 The Apache Software Foundation

  

  Licensed under the Apache License, Version 2.0 (the "License");

  you may not use this file except in compliance with the License.

  You may obtain a copy of the License at

  

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

  

  Unless required by applicable law or agreed to in writing, software

  distributed under the License is distributed on an "AS IS" BASIS,

  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  See the License for the specific language governing permissions and

  limitations under the License.

  -->

  <project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd";>

      <!-- Include parent configuration file -->

      <include buildfile="../nant.config" />

  </project>

  
  
  
  1.1                  
logging-log4net/examples/net/1.0/Layouts/SampleLayoutsApp/cs/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  bin
  doc
  build
  
  
  
  
  1.1                  
logging-log4net/examples/net/1.0/Layouts/SampleLayoutsApp/cs/nant.build
  
  Index: nant.build
  ===================================================================
  <?xml version="1.0" ?>

  <!--

  Copyright 2004-2005 The Apache Software Foundation

  

  Licensed under the Apache License, Version 2.0 (the "License");

  you may not use this file except in compliance with the License.

  You may obtain a copy of the License at

  

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

  

  Unless required by applicable law or agreed to in writing, software

  distributed under the License is distributed on an "AS IS" BASIS,

  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  See the License for the specific language governing permissions and

  limitations under the License.

  -->

  <project name="samplelayoutssapp-cs-exa,ple" 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-log4net-assembly">

          <!-- copy log4net build output  -->

          <copy todir="${current.bin.dir}">

              <fileset basedir="${log4net.output.dir}">

                  <include name="*.*" />

              </fileset>

          </copy>

          <!-- compile the example -->

          <csc noconfig="true" target="exe" warnaserror="true" 
debug="${current.build.debug}" define="${current.build.defines.csc}" 
output="${current.bin.dir}/SampleLayoutssApp.exe">

              <sources>

                  <include name="src/**/*.cs" />

                  <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" 
/>

              </sources>

              <references basedir="${current.bin.dir}">

                  <include name="log4net.dll" />

                  <include name="System.dll" />

                  <include name="System.Web.dll" />

                  <include name="System.Windows.Forms.dll" />

              </references>

          </csc>

          <!-- copy the ConsoleApp application configuration file -->

          <copy file="src/App.config" 
tofile="${current.bin.dir}/SampleLayoutsApp.exe.config" />

      </target>

  </project>

  
  
  
  1.1                  
logging-log4net/examples/net/1.0/Layouts/SampleLayoutsApp/cs/nant.config
  
  Index: nant.config
  ===================================================================
  <?xml version="1.0" ?>

  <!--

  Copyright 2004-2005 The Apache Software Foundation

  

  Licensed under the Apache License, Version 2.0 (the "License");

  you may not use this file except in compliance with the License.

  You may obtain a copy of the License at

  

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

  

  Unless required by applicable law or agreed to in writing, software

  distributed under the License is distributed on an "AS IS" BASIS,

  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  See the License for the specific language governing permissions and

  limitations under the License.

  -->

  <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="../../../../../../" />

  </project>

  
  
  
  1.1                  
logging-log4net/examples/net/1.0/Layouts/SampleLayoutsApp/cs/src/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  obj
  *.csproj.user
  bin
  doc
  
  
  
  
  1.1                  
logging-log4net/examples/net/1.0/Layouts/SampleLayoutsApp/cs/src/App.config
  
  Index: App.config
  ===================================================================
  <?xml version="1.0" encoding="utf-8" ?>

  <!-- 

                .NET application configuration file     

                This file must have the exact same name as your application 
with .config appended to it. 

                

                For example if your application is ConsoleApp.exe then the 
config file must be ConsoleApp.exe.config. 

                It must also be in the same directory as the application. 

        -->

  <configuration>

        <!-- Register a section handler for the log4net section -->

        <configSections>

                <section name="log4net" 
type="System.Configuration.IgnoreSectionHandler" />

        </configSections>

        

        <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>

  

                <appender name="ConsoleAppender" 
type="log4net.Appender.ConsoleAppender">

                        <layout 
type="SampleLayoutsApp.Layout.LineWrappingLayout,SampleLayoutsApp">

                                <indent value="8" />

                                <layout type="log4net.Layout.PatternLayout" 
value="%date [%thread] %-5level %logger - %message%newline" />

                        </layout>

                </appender>

                

                <!-- Setup the root category, add the appenders and set the 
default level -->

                <root>

                        <level value="ALL" />

                        

                        <appender-ref ref="ConsoleAppender" />

                </root>

                

        </log4net>

  </configuration>

  
  
  
  1.1                  
logging-log4net/examples/net/1.0/Layouts/SampleLayoutsApp/cs/src/AssemblyInfo.cs
  
  Index: AssemblyInfo.cs
  ===================================================================
  #region Copyright & License

  //

  // Copyright 2001-2005 The Apache Software Foundation

  //

  // Licensed under the Apache License, Version 2.0 (the "License");

  // you may not use this file except in compliance with the License.

  // You may obtain a copy of the License at

  //

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

  //

  // Unless required by applicable law or agreed to in writing, software

  // distributed under the License is distributed on an "AS IS" BASIS,

  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  // See the License for the specific language governing permissions and

  // limitations under the License.

  //

  #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 - SampleLayoutsApp")]

  [assembly: AssemblyDescription("log4net SampleLayoutsApp")]

  [assembly: AssemblyConfiguration("")]

  [assembly: AssemblyProduct("log4net - SampleLayoutsApp")]

  [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/net/1.0/Layouts/SampleLayoutsApp/cs/src/LoggingExample.cs
  
  Index: LoggingExample.cs
  ===================================================================
  #region Copyright & License

  //

  // Copyright 2001-2005 The Apache Software Foundation

  //

  // Licensed under the Apache License, Version 2.0 (the "License");

  // you may not use this file except in compliance with the License.

  // You may obtain a copy of the License at

  //

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

  //

  // Unless required by applicable law or agreed to in writing, software

  // distributed under the License is distributed on an "AS IS" BASIS,

  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  // See the License for the specific language governing permissions and

  // limitations under the License.

  //

  #endregion

  

  using System;

  

  // Configure log4net using the .config file

  [assembly: log4net.Config.XmlConfigurator(Watch=true)]

  // This will cause log4net to look for a configuration file

  // called ConsoleApp.exe.config in the application base

  // directory (i.e. the directory containing SampleAppendersApp.exe)

  

  namespace SampleLayoutsApp

  {

        /// <summary>

        /// Example of how to simply configure and use log4net

        /// </summary>

        public class LoggingExample

        {

                // Create a logger for use in this class

                private static readonly log4net.ILog log = 
log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

                // NOTE that using 
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType

                // is equivalent to typeof(LoggingExample) but is more portable

                // i.e. you can copy the code directly into another class 
without

                // needing to edit the code.

  

                /// <summary>

                /// Application entry point

                /// </summary>

                /// <param name="args">command line arguments</param>

                public static void Main(string[] args)

                {

                        // Log an info level message

                        if (log.IsInfoEnabled) log.Info("Application 
[SampleLayoutsApp] 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");

  

                        log.Info("This is a long line of logging text. This 
should test if the LineWrappingLayout works. This text should be wrapped over 
multiple lines of output. Could you get a log message longer than this?");

  

                        log.Error("Hey this is an error!");

  

                        // Log an info level message

                        if (log.IsInfoEnabled) log.Info("Application 
[SampleLayoutsApp] End");

  

                        Console.Write("Press Enter to exit...");

                        Console.ReadLine();

                }

        }

  }

  
  
  
  1.1                  
logging-log4net/examples/net/1.0/Layouts/SampleLayoutsApp/cs/src/SampleLayoutsApp.csproj
  
  Index: SampleLayoutsApp.csproj
  ===================================================================
  <VisualStudioProject>

      <CSHARP

          ProjectType = "Local"

          ProductVersion = "7.0.9466"

          SchemaVersion = "1.0"

          ProjectGuid = "{CD7A8094-D383-46BC-A75D-9F65F746E24F}"

      >

          <Build>

              <Settings

                  ApplicationIcon = ""

                  AssemblyKeyContainerName = ""

                  AssemblyName = "SampleLayoutsApp"

                  AssemblyOriginatorKeyFile = ""

                  DefaultClientScript = "JScript"

                  DefaultHTMLPageLayout = "Grid"

                  DefaultTargetSchema = "IE50"

                  DelaySign = "false"

                  OutputType = "Exe"

                  RootNamespace = "SampleLayoutsApp"

                  StartupObject = "SampleLayoutsApp.LoggingExample"

              >

                  <Config

                      Name = "Debug"

                      AllowUnsafeBlocks = "false"

                      BaseAddress = "285212672"

                      CheckForOverflowUnderflow = "false"

                      ConfigurationOverrideFile = ""

                      DefineConstants = "DEBUG;TRACE"

                      DocumentationFile = ""

                      DebugSymbols = "true"

                      FileAlignment = "4096"

                      IncrementalBuild = "true"

                      Optimize = "false"

                      OutputPath = "..\build\debug\"

                      RegisterForComInterop = "false"

                      RemoveIntegerChecks = "false"

                      TreatWarningsAsErrors = "false"

                      WarningLevel = "4"

                  />

                  <Config

                      Name = "Release"

                      AllowUnsafeBlocks = "false"

                      BaseAddress = "285212672"

                      CheckForOverflowUnderflow = "false"

                      ConfigurationOverrideFile = ""

                      DefineConstants = "TRACE"

                      DocumentationFile = ""

                      DebugSymbols = "false"

                      FileAlignment = "4096"

                      IncrementalBuild = "true"

                      Optimize = "true"

                      OutputPath = "..\build\release\"

                      RegisterForComInterop = "false"

                      RemoveIntegerChecks = "false"

                      TreatWarningsAsErrors = "false"

                      WarningLevel = "4"

                  />

              </Settings>

              <References>

                  <Reference

                      Name = "System"

                      AssemblyName = "System"

                  />

                  <Reference

                      Name = "System.Data"

                      AssemblyName = "System.Data"

                  />

                  <Reference

                      Name = "System.XML"

                      AssemblyName = "System.Xml"

                  />

                  <Reference

                      Name = "log4net"

                      AssemblyName = "log4net"

                      HintPath = 
"..\..\..\..\..\..\..\bin\net\1.0\release\log4net.dll"

                  />

                  <Reference

                      Name = "System.Windows.Forms"

                      AssemblyName = "System.Windows.Forms"

                      HintPath = 
"..\..\..\..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll"

                  />

                  <Reference

                      Name = "System.Web"

                      AssemblyName = "System.Web"

                      HintPath = 
"..\..\..\..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Web.dll"

                  />

                  <Reference

                      Name = "System.Messaging"

                      AssemblyName = "System.Messaging"

                      HintPath = 
"..\..\..\..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Messaging.dll"

                  />

              </References>

          </Build>

          <Files>

              <Include>

                  <File

                      RelPath = "App.config"

                      BuildAction = "None"

                  />

                  <File

                      RelPath = "AssemblyInfo.cs"

                      SubType = "Code"

                      BuildAction = "Compile"

                  />

                  <File

                      RelPath = "AssemblyVersionInfo.cs"

                      Link = "..\..\..\..\..\..\..\src\AssemblyVersionInfo.cs"

                      SubType = "Code"

                      BuildAction = "Compile"

                  />

                  <File

                      RelPath = "LoggingExample.cs"

                      SubType = "Code"

                      BuildAction = "Compile"

                  />

                  <File

                      RelPath = "Layout\ForwardingLayout.cs"

                      SubType = "Code"

                      BuildAction = "Compile"

                  />

                  <File

                      RelPath = "Layout\LineWrappingLayout.cs"

                      SubType = "Code"

                      BuildAction = "Compile"

                  />

              </Include>

          </Files>

      </CSHARP>

  </VisualStudioProject>

  

  
  
  
  1.1                  
logging-log4net/examples/net/1.0/Layouts/SampleLayoutsApp/cs/src/Layout/ForwardingLayout.cs
  
  Index: ForwardingLayout.cs
  ===================================================================
  #region Copyright & License

  //

  // Copyright 2001-2005 The Apache Software Foundation

  //

  // Licensed under the Apache License, Version 2.0 (the "License");

  // you may not use this file except in compliance with the License.

  // You may obtain a copy of the License at

  //

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

  //

  // Unless required by applicable law or agreed to in writing, software

  // distributed under the License is distributed on an "AS IS" BASIS,

  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  // See the License for the specific language governing permissions and

  // limitations under the License.

  //

  #endregion

  

  using System;

  using System.IO;

  using log4net.Layout;

  using log4net.Core;

  using log4net.Util;

  

  namespace SampleLayoutsApp.Layout

  {

        /// <summary>

        /// The ForwardingLayout forwards to a nested <see cref="ILayout"/>

        /// </summary>

        /// <remarks>

        /// The ForwardingLayout base class is used by layouts that want

        /// to decorate other <see cref="ILayout"/> objects.

        /// </remarks>

        public abstract class ForwardingLayout : ILayout, IOptionHandler

        {

                private ILayout m_nestedLayout;

  

                protected ForwardingLayout()

                {

                }

  

                public ILayout Layout

                {

                        get { return m_nestedLayout; }

                        set { m_nestedLayout = value; }

                }

  

                #region Implementation of IOptionHandler

  

                /// <summary>

                /// Activate component options

                /// </summary>

                /// <remarks>

                /// <para>

                /// This is part of the <see cref="IOptionHandler"/> delayed 
object

                /// activation scheme. The <see cref="ActivateOptions"/> method 
must 

                /// be called on this object after the configuration properties 
have

                /// been set. Until <see cref="ActivateOptions"/> is called this

                /// object is in an undefined state and must not be used. 

                /// </para>

                /// <para>

                /// If any of the configuration properties are modified then 

                /// <see cref="ActivateOptions"/> must be called again.

                /// </para>

                /// <para>

                /// This method must be implemented by the subclass.

                /// </para>

                /// </remarks>

                public virtual void ActivateOptions()

                {

                        IOptionHandler optionHandler = m_nestedLayout as 
IOptionHandler;

                        if (optionHandler != null)

                        {

                                optionHandler.ActivateOptions();

                        }

                }

  

                #endregion

  

                #region Implementation of ILayout

  

                /// <summary>

                /// Implement this method to create your own layout format.

                /// </summary>

                /// <param name="writer">The TextWriter to write the formatted 
event to</param>

                /// <param name="loggingEvent">The event to format</param>

                /// <remarks>

                /// <para>

                /// This method is called by an appender to format

                /// the <paramref name="loggingEvent"/> as text.

                /// </para>

                /// </remarks>

                virtual public void Format(TextWriter writer, LoggingEvent 
loggingEvent)

                {

                        if (m_nestedLayout != null)

                        {

                                m_nestedLayout.Format(writer, loggingEvent);

                        }

                }

  

                /// <summary>

                /// The content type output by this layout. 

                /// </summary>

                /// <value>The content type is <c>"text/plain"</c></value>

                /// <remarks>

                /// <para>

                /// The content type output by this layout.

                /// </para>

                /// <para>

                /// This base class uses the value <c>"text/plain"</c>.

                /// To change this value a subclass must override this

                /// property.

                /// </para>

                /// </remarks>

                virtual public string ContentType

                {

                        get 

                        {

                                if (m_nestedLayout != null)

                                {

                                        return m_nestedLayout.ContentType;

                                }

                                return "text/plain"; 

                        }

                }

  

                /// <summary>

                /// The header for the layout format.

                /// </summary>

                /// <value>the layout header</value>

                /// <remarks>

                /// <para>

                /// The Header text will be appended before any logging events

                /// are formatted and appended.

                /// </para>

                /// </remarks>

                virtual public string Header

                {

                        get 

                        { 

                                if (m_nestedLayout != null)

                                {

                                        return m_nestedLayout.Header;

                                }

                                return null;

                        }

                }

  

                /// <summary>

                /// The footer for the layout format.

                /// </summary>

                /// <value>the layout footer</value>

                /// <remarks>

                /// <para>

                /// The Footer text will be appended after all the logging 
events

                /// have been formatted and appended.

                /// </para>

                /// </remarks>

                virtual public string Footer

                {

                        get 

                        { 

                                if (m_nestedLayout != null)

                                {

                                        return m_nestedLayout.Footer;

                                }

                                return null;

                        }

                }

  

                /// <summary>

                /// Flag indicating if this layout handles exceptions

                /// </summary>

                /// <value><c>false</c> if this layout handles 
exceptions</value>

                /// <remarks>

                /// <para>

                /// If this layout handles the exception object contained within

                /// <see cref="LoggingEvent"/>, then the layout should return

                /// <c>false</c>. Otherwise, if the layout ignores the exception

                /// object, then the layout should return <c>true</c>.

                /// </para>

                /// <para>

                /// Set this value to override a this default setting. The 
default

                /// value is <c>true</c>, this layout does not handle the 
exception.

                /// </para>

                /// </remarks>

                virtual public bool IgnoresException 

                { 

                        get 

                        { 

                                if (m_nestedLayout != null)

                                {

                                        return m_nestedLayout.IgnoresException;

                                }

                                return true;

                        }

                }

  

                #endregion

        }

  }

  
  
  
  1.1                  
logging-log4net/examples/net/1.0/Layouts/SampleLayoutsApp/cs/src/Layout/LineWrappingLayout.cs
  
  Index: LineWrappingLayout.cs
  ===================================================================
  #region Copyright & License

  //

  // Copyright 2001-2005 The Apache Software Foundation

  //

  // Licensed under the Apache License, Version 2.0 (the "License");

  // you may not use this file except in compliance with the License.

  // You may obtain a copy of the License at

  //

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

  //

  // Unless required by applicable law or agreed to in writing, software

  // distributed under the License is distributed on an "AS IS" BASIS,

  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  // See the License for the specific language governing permissions and

  // limitations under the License.

  //

  #endregion

  

  using System;

  using System.IO;

  using System.Text;

  using log4net.Layout;

  using log4net.Core;

  using log4net.Util;

  

  namespace SampleLayoutsApp.Layout

  {

        /// <summary>

        /// The LineWrappingLayout wraps the output of a nested layout

        /// </summary>

        /// <remarks>

        /// The output of the nested layout is wrapped at

        /// <see cref="LineWidth"/>. Each of the continuation lines

        /// is prefixed with a number of spaces specified by <see 
cref="Indent"/>.

        /// </remarks>

        public class LineWrappingLayout : ForwardingLayout

        {

                private int m_lineWidth = 76;

                private int m_indent = 4;

  

                public LineWrappingLayout()

                {

                }

  

                public int LineWidth

                {

                        get { return m_lineWidth; }

                        set { m_lineWidth = value; }

                }

                public int Indent

                {

                        get { return m_indent; }

                        set { m_indent = value; }

                }

  

                override public void Format(TextWriter writer, LoggingEvent 
loggingEvent)

                {

                        StringWriter stringWriter = new StringWriter();

  

                        base.Format(stringWriter, loggingEvent);

  

                        string formattedString = stringWriter.ToString();

  

                        WrapText(writer, formattedString);

                }

  

                private void WrapText(TextWriter writer, string text)

                {

                        if (text.Length <= m_lineWidth)

                        {

                                writer.Write(text);

                        }

                        else

                        {

                                // Do the first line

                                writer.WriteLine(text.Substring(0, 
m_lineWidth));

                                string rest = text.Substring(m_lineWidth);

  

                                string indentString = new String(' ', m_indent);

                                int continuationLineWidth = m_lineWidth - 
m_indent;

  

                                // Do the continuation lines

                                while(true)

                                {

                                        writer.Write(indentString);

  

                                        if (rest.Length > continuationLineWidth)

                                        {

                                                
writer.WriteLine(rest.Substring(0, continuationLineWidth));

                                                rest = 
rest.Substring(continuationLineWidth);

                                        }

                                        else

                                        {

                                                writer.Write(rest);

                                                break;

                                        }

                                }

                        }

                }

        }

  }

  
  
  
  1.9       +35 -7     logging-log4net/xdocs/src/release/example-apps.xml
  
  Index: example-apps.xml
  ===================================================================
  RCS file: /home/cvs/logging-log4net/xdocs/src/release/example-apps.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- example-apps.xml  29 Aug 2005 15:13:28 -0000      1.8
  +++ example-apps.xml  29 Aug 2005 15:25:46 -0000      1.9
  @@ -145,7 +145,7 @@
                                                </li>

                                        </ul>

                                        <p>

  -                                             To run this example execute the 
<span class="code">ConsoleApp.exe</span> from the build output directory.

  +                                             To run this example execute 
<span class="code">ConsoleApp.exe</span> from the build output directory.

                                        </p>

                                </section>

                                

  @@ -194,7 +194,7 @@
                                                </li>

                                        </ul>

                                        <p>

  -                                             To run this example execute the 
<span class="code">RemotingClient.exe</span> from the build output directory.

  +                                             To run this example execute 
<span class="code">RemotingClient.exe</span> from the build output directory.

                                        </p>

                                </section>

                                

  @@ -217,7 +217,7 @@
                                                </li>

                                        </ul>

                                        <p>

  -                                             To run this example execute the 
<span class="code">RemotingServer.exe</span> from the build output directory.

  +                                             To run this example execute 
<span class="code">RemotingServer.exe</span> from the build output directory.

                                                While this process is running 
execute the <span class="code">RemotingClient.exe</span> program on

                                                the same machine. The logging 
events from the client are transferred to the server.

                                        </p>

  @@ -325,7 +325,7 @@
                                                </li>

                                        </ul>

                                        <p>

  -                                             To run this example execute the 
<span class="code">SimpleApp.exe</span> from the build output directory.

  +                                             To run this example execute 
<span class="code">SimpleApp.exe</span> from the build output directory.

                                        </p>

                                </section>

                                

  @@ -347,7 +347,7 @@
                                                </li>

                                        </ul>

                                        <p>

  -                                             To run this example execute the 
<span class="code">EventIDLogApp.exe</span> from the build output directory.

  +                                             To run this example execute 
<span class="code">EventIDLogApp.exe</span> from the build output directory.

                                        </p>

                                </section>

                                

  @@ -369,7 +369,7 @@
                                                </li>

                                        </ul>

                                        <p>

  -                                             To run this example execute the 
<span class="code">TraceLogApp.exe</span> from the build output directory.

  +                                             To run this example execute 
<span class="code">TraceLogApp.exe</span> from the build output directory.

                                        </p>

                                </section>

                                

  @@ -415,10 +415,38 @@
                                                </li>

                                        </ul>

                                        <p>

  -                                             To run this example execute the 
<span class="code">SampleAppendersApp.exe</span> from the build output 
directory.

  +                                             To run this example execute 
<span class="code">SampleAppendersApp.exe</span> from the build output 
directory.

                                        </p>

                                </section>

                                

  +                             <section id="samplelayouts" 
name="SampleLayouts">

  +                                     <p>

  +                                             This project includes the 
following example layouts.

  +                                     </p>

  +                                     <ul>

  +                                             <li>

  +                                                     ForwardingLayout

  +                                             </li>

  +                                             <li>

  +                                                     LineWrappingLayout

  +                                             </li>

  +                                     </ul>

  +                                     <p>

  +                                             This example is available for 
the following platforms and languages. If a version

  +                                             is not available for your 
chosen platform and language combination then select the

  +                                             nearest platform for the 
appropriate language.

  +                                     </p>

  +                                     <ul>

  +                                             <li>

  +                                                     <b>.NET 1.0</b>: 

  +                                                     <a class="localOnly" 
href="../../examples/net/1.0/Layouts/SampleLayoutsApp/cs">C#</a>

  +                                             </li>

  +                                     </ul>

  +                                     <p>

  +                                             To run this example execute 
<span class="code">SampleLayoutsApp.exe</span> from the build output directory.

  +                                     </p>

  +                             </section>                              

  +                             

                                <section id="perf-notlogging" name="Performance 
- NotLogging">

                                        <p>

                                                The NotLogging example 
benchmarks the performance of log4net logging statements in

  
  
  

Reply via email to