[prev in list] [next in list] [prev in thread] [next in thread]
List: log4net-dev
Subject: svn commit: r778044 - in
From: rgrabowski () apache ! org
Date: 2009-05-23 22:13:13
Message-ID: 20090523221313.55F952388892 () eris ! apache ! org
[Download RAW message or body]
Author: rgrabowski
Date: Sat May 23 22:13:12 2009
New Revision: 778044
URL: http://svn.apache.org/viewvc?rev=778044&view=rev
Log:
Sample AdoNetAppender that makes adding pattern layouts and converters slightly less \
verbose:
<parameter>
<parameterName value="@MyColumn "/>
<dbType value="String" />
<size value="255" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%property{MyColumn}" />
</layout>
</parameter>
<patternLayoutParameter>
<parameterName value="@MyColumn "/>
<dbType value="String" />
<size value="255" />
<conversionPattern value="%property{MyColumn}" />
</patternLayoutParameter>
Added:
logging/log4net/trunk/examples/net/1.0/Appenders/SampleAppendersApp/cs/src/Appender/PatternLayoutAdoNetAppender.cs
logging/log4net/trunk/examples/net/1.0/Appenders/SampleAppendersApp/cs/src/Appender/PatternLayoutAdoNetAppenderParameter.cs
logging/log4net/trunk/examples/net/1.0/Appenders/SampleAppendersApp/cs/src/SampleAppendersApp.vs2005.csproj
Added: logging/log4net/trunk/examples/net/1.0/Appenders/SampleAppendersApp/cs/src/Appender/PatternLayoutAdoNetAppender.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/examples/net/1.0/Appenders/Sam \
pleAppendersApp/cs/src/Appender/PatternLayoutAdoNetAppender.cs?rev=778044&view=auto \
==============================================================================
--- logging/log4net/trunk/examples/net/1.0/Appenders/SampleAppendersApp/cs/src/Appender/PatternLayoutAdoNetAppender.cs \
(added)
+++ logging/log4net/trunk/examples/net/1.0/Appenders/SampleAppendersApp/cs/src/Appender/PatternLayoutAdoNetAppender.cs \
Sat May 23 22:13:12 2009 @@ -0,0 +1,86 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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.Collections;
+using log4net.Appender;
+using log4net.Layout;
+using log4net.Util;
+
+namespace SampleAppendersApp.Appender
+{
+ /// <summary>
+ ///
+ /// </summary>
+ /// <example>
+ /// <code>
+ /// <![CDATA[
+ /// <appender name="PatternLayoutAdoNetAppender" \
type="ConsoleApplication1.PatternLayoutAdoNetAppender, ConsoleApplication1"> + /// \
<connectionType value="log4net.Tests.Appender.AdoNet.Log4NetConnection, \
log4net.Tests" /> + /// <connectionString value="..." />
+ /// <commandText value="INSERT INTO Log4Net (CustomValue1, CustomValue2) \
VALUES (@CustomValue1, @CustsomValue2)" /> + /// <converter>
+ /// <name value="echo" />
+ /// <type value="ConsoleApplication1.EchoConverter, ConsoleApplication1" />
+ /// </converter>
+ /// <converter>
+ /// <name value="reverse" />
+ /// <type value="ConsoleApplication1.ReverseConverter, ConsoleApplication1" \
/> + /// </converter>
+ /// <patternLayoutParameter>
+ /// <parameterName value="@CustomValue1"/>
+ /// <dbType value="String" />
+ /// <conversionPattern value="%echo{Hello World}" />
+ /// </patternLayoutParameter>
+ /// <patternLayoutParameter>
+ /// <parameterName value="@CustomValue2"/>
+ /// <dbType value="String" />
+ /// <conversionPattern value="%reverse{Goodbye}" />
+ /// </patternLayoutParameter>
+ /// </appender>
+ /// ]]>
+ /// </code>
+ /// </example>
+ public class PatternLayoutAdoNetAppender : AdoNetAppender
+ {
+ private readonly ArrayList m_converters = new ArrayList();
+
+ public void AddConverter(ConverterInfo converterInfo)
+ {
+ m_converters.Add(converterInfo);
+ }
+
+ public void AddPatternLayoutParameter(PatternLayoutAdoNetAppenderParameter \
parameter) + {
+ PatternLayout patternLayout = new \
PatternLayout(parameter.ConversionPattern); + addConveters(patternLayout);
+ patternLayout.ActivateOptions();
+
+ parameter.Layout = new Layout2RawLayoutAdapter(patternLayout);
+ m_parameters.Add(parameter);
+ }
+
+ private void addConveters(PatternLayout patternLayout)
+ {
+ foreach (ConverterInfo conveterInfo in m_converters)
+ {
+ patternLayout.AddConverter(conveterInfo);
+ }
+ }
+ }
+}
\ No newline at end of file
Added: logging/log4net/trunk/examples/net/1.0/Appenders/SampleAppendersApp/cs/src/Appender/PatternLayoutAdoNetAppenderParameter.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/examples/net/1.0/Appenders/Sam \
pleAppendersApp/cs/src/Appender/PatternLayoutAdoNetAppenderParameter.cs?rev=778044&view=auto
==============================================================================
--- logging/log4net/trunk/examples/net/1.0/Appenders/SampleAppendersApp/cs/src/Appender/PatternLayoutAdoNetAppenderParameter.cs \
(added)
+++ logging/log4net/trunk/examples/net/1.0/Appenders/SampleAppendersApp/cs/src/Appender/PatternLayoutAdoNetAppenderParameter.cs \
Sat May 23 22:13:12 2009 @@ -0,0 +1,34 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to you 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 log4net.Appender;
+
+namespace SampleAppendersApp.Appender
+{
+ public class PatternLayoutAdoNetAppenderParameter : AdoNetAppenderParameter
+ {
+ private string conversionPattern;
+
+ public string ConversionPattern
+ {
+ get { return conversionPattern; }
+ set { conversionPattern = value; }
+ }
+ }
+}
Added: logging/log4net/trunk/examples/net/1.0/Appenders/SampleAppendersApp/cs/src/SampleAppendersApp.vs2005.csproj
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/examples/net/1.0/Appenders/SampleAppendersApp/cs/src/SampleAppendersApp.vs2005.csproj?rev=778044&view=auto
==============================================================================
--- logging/log4net/trunk/examples/net/1.0/Appenders/SampleAppendersApp/cs/src/SampleAppendersApp.vs2005.csproj \
(added)
+++ logging/log4net/trunk/examples/net/1.0/Appenders/SampleAppendersApp/cs/src/SampleAppendersApp.vs2005.csproj \
Sat May 23 22:13:12 2009 @@ -0,0 +1,138 @@
+ï » ¿<Project DefaultTargets="Build" \
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{9E715F72-7F70-421B-A2BF-E9CB42F88F5C}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ApplicationIcon>
+ </ApplicationIcon>
+ <AssemblyKeyContainerName>
+ </AssemblyKeyContainerName>
+ <AssemblyName>SampleAppendersApp</AssemblyName>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <DefaultClientScript>JScript</DefaultClientScript>
+ <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+ <DefaultTargetSchema>IE50</DefaultTargetSchema>
+ <DelaySign>false</DelaySign>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>SampleAppendersApp</RootNamespace>
+ <StartupObject>SampleAppendersApp.LoggingExample</StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <OutputPath>..\build\debug\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>true</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <Optimize>false</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>full</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <OutputPath>..\build\release\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>false</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <Optimize>true</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>none</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, \
processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\..\..\..\..\..\build\bin\net\1.0\debug\log4net.dll</HintPath>
+ </Reference>
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ <Reference Include="System.Data">
+ <Name>System.Data</Name>
+ </Reference>
+ <Reference Include="System.Messaging">
+ <Name>System.Messaging</Name>
+ </Reference>
+ <Reference Include="System.Web">
+ <Name>System.Web</Name>
+ </Reference>
+ <Reference Include="System.Windows.Forms">
+ <Name>System.Windows.Forms</Name>
+ </Reference>
+ <Reference Include="System.Xml">
+ <Name>System.XML</Name>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ <Compile Include="..\..\..\..\..\..\..\src\AssemblyVersionInfo.cs">
+ <Link>AssemblyVersionInfo.cs</Link>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Appender\AsyncAppender.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Appender\FastDbAppender.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Appender\FireEventAppender.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Appender\MessageBoxAppender.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Appender\MessageObjectExpanderAppender.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Appender\MsmqAppender.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Appender\PatternFileAppender.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Appender\PatternLayoutAdoNetAppender.cs" />
+ <Compile Include="Appender\PatternLayoutAdoNetAppenderParameter.cs" />
+ <Compile Include="Appender\SimpleSmtpAppender.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="AssemblyInfo.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="LoggingExample.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+</Project>
\ No newline at end of file
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic