ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [31/34] ignite git commit: IGNITE-3820: .NET: Added log4net integration. This closes #1138.
Date Mon, 10 Oct 2016 16:00:58 GMT
IGNITE-3820: .NET: Added log4net integration. This closes #1138.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/02f48d72
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/02f48d72
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/02f48d72

Branch: refs/heads/ignite-comm-opts2
Commit: 02f48d72364fb0c52e95aef8ed383a14ee531bf6
Parents: 48b293d
Author: ptupitsyn <ptupitsyn@gridgain.com>
Authored: Tue Oct 4 11:17:54 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Tue Oct 4 11:17:54 2016 +0300

----------------------------------------------------------------------
 .../Apache.Ignite.Core.Tests.NuGet.csproj       |  10 +
 .../Log4NetTest.cs                              |  87 +++++++++
 .../packages.config                             |   2 +
 .../Apache.Ignite.Core.Tests.csproj             |   9 +
 .../Log/Log4NetLoggerTest.cs                    | 188 +++++++++++++++++++
 .../Apache.Ignite.Core.Tests/packages.config    |  24 +++
 .../Apache.Ignite.Log4Net.csproj                |  76 ++++++++
 .../Apache.Ignite.Log4Net.nuspec                |  50 +++++
 .../Apache.Ignite.Log4Net.snk                   | Bin 0 -> 596 bytes
 .../IgniteLog4NetLogger.cs                      | 123 ++++++++++++
 .../Properties/AssemblyInfo.cs                  |  40 ++++
 .../Apache.Ignite.Log4Net/packages.config       |  20 ++
 .../Properties/AssemblyInfo.cs                  |   2 +-
 modules/platforms/dotnet/Apache.Ignite.sln      |  16 +-
 14 files changed, 645 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/02f48d72/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Apache.Ignite.Core.Tests.NuGet.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Apache.Ignite.Core.Tests.NuGet.csproj
b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Apache.Ignite.Core.Tests.NuGet.csproj
index f3f917e..335d711 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Apache.Ignite.Core.Tests.NuGet.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Apache.Ignite.Core.Tests.NuGet.csproj
@@ -90,6 +90,11 @@
       <HintPath>packages\Apache.Ignite.NLog.1.8.0\lib\net40\Apache.Ignite.NLog.dll</HintPath>
       <Private>True</Private>
     </Reference>
+    <Reference Include="Apache.Ignite.Log4Net">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>packages\Apache.Ignite.Log4Net.1.8.0\lib\net40\Apache.Ignite.Log4Net.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
     <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c,
processorArchitecture=MSIL">
       <HintPath>packages\NLog.4.3.7\lib\net40\NLog.dll</HintPath>
       <Private>True</Private>
@@ -105,6 +110,10 @@
       <HintPath>packages\Remotion.Linq.2.0.1\lib\net40\Remotion.Linq.dll</HintPath>
       <Private>True</Private>
     </Reference>
+    <Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a,
processorArchitecture=MSIL">
+      <HintPath>packages\log4net.2.0.5\lib\net40-full\log4net.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Configuration" />
     <Reference Include="System.Core" />
@@ -112,6 +121,7 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Log4NetTest.cs" />
     <Compile Include="NLogTest.cs" />
     <Compile Include="AspNetTest.cs" />
     <Compile Include="ComputeTest.cs" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/02f48d72/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Log4NetTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Log4NetTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Log4NetTest.cs
new file mode 100644
index 0000000..c53ea28
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Log4NetTest.cs
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Tests.NuGet
+{
+    using System;
+    using System.Collections.Generic;
+    using System.Linq;
+    using Apache.Ignite.Core.Log;
+    using Apache.Ignite.Log4Net;
+    using global::log4net;
+    using global::log4net.Appender;
+    using global::log4net.Core;
+    using global::log4net.Repository.Hierarchy;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// log4net tests.
+    /// </summary>
+    public class Log4NetTest
+    {
+        /// <summary>
+        /// Tests the logger with Ignite.
+        /// </summary>
+        [Test]
+        public void TestIgniteStartup()
+        {
+            var memoryLog = CreateMemoryLogger();
+            var logger = new IgniteLog4NetLogger();
+
+            var cfg = new IgniteConfiguration
+            {
+                DiscoverySpi = TestUtil.GetLocalDiscoverySpi(),
+                Logger = logger
+            };
+
+            Func<IEnumerable<string>> getLogs = () => memoryLog.GetEvents().Select(x
=> x.MessageObject.ToString());
+
+            using (var ignite = Ignition.Start(cfg))
+            {
+                Assert.IsTrue(getLogs().Contains(
+                    string.Format("Starting Ignite.NET {0}", typeof(Ignition).Assembly.GetName().Version)));
+
+                Assert.IsTrue(getLogs().Any(x => x.Contains(">>> Topology snapshot.")));
+
+                Assert.IsInstanceOf<IgniteLog4NetLogger>(ignite.Logger);
+
+                ignite.Logger.Info("Log from user code.");
+
+                Assert.IsTrue(getLogs().Contains("Log from user code."));
+            }
+
+            Assert.IsTrue(getLogs().Contains("Grid is stopping."));
+        }
+
+        /// <summary>
+        /// Creates the memory logger.
+        /// </summary>
+        private static MemoryAppender CreateMemoryLogger()
+        {
+            var hierarchy = (Hierarchy) LogManager.GetRepository();
+
+            var memory = new MemoryAppender();
+            memory.ActivateOptions();
+            hierarchy.Root.AddAppender(memory);
+
+            hierarchy.Root.Level = Level.All;
+            hierarchy.Configured = true;
+
+            return memory;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/02f48d72/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/packages.config
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/packages.config b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/packages.config
index 30e71a1..80454e0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/packages.config
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/packages.config
@@ -20,8 +20,10 @@
   <package id="Apache.Ignite.AspNet" version="1.8.0" targetFramework="net40" />
   <package id="Apache.Ignite.Linq" version="1.8.0" targetFramework="net40" />
   <package id="Apache.Ignite.NLog" version="1.8.0" targetFramework="net40" />
+  <package id="Apache.Ignite.Log4Net" version="1.8.0" targetFramework="net40" />
   <package id="Apache.Ignite.Schema" version="1.8.0" targetFramework="net40" />
   <package id="NLog" version="4.3.7" targetFramework="net40" />
   <package id="NUnit.Runners" version="2.6.3" targetFramework="net40" />
   <package id="Remotion.Linq" version="2.0.1" targetFramework="net40" />
+  <package id="log4net" version="2.0.5" targetFramework="net40" />
 </packages>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/02f48d72/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index ef62498..008229a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -37,6 +37,10 @@
     <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a,
processorArchitecture=MSIL">
+      <HintPath>..\packages\log4net.2.0.5\lib\net40-full\log4net.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
     <Reference Include="Microsoft.CSharp" />
     <Reference Include="NLog">
       <HintPath>..\packages\NLog.4.3.7\lib\net40\NLog.dll</HintPath>
@@ -58,6 +62,7 @@
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Log\DefaultLoggerTest.cs" />
+    <Compile Include="Log\Log4NetLoggerTest.cs" />
     <Compile Include="Log\NLogLoggerTest.cs" />
     <Compile Include="TestAppConfig.cs" />
     <Compile Include="Binary\BinaryBuilderSelfTestFullFooter.cs" />
@@ -180,6 +185,10 @@
       <Project>{5b571661-17f4-4f29-8c7d-0edb38ca9b55}</Project>
       <Name>Apache.Ignite.Linq</Name>
     </ProjectReference>
+    <ProjectReference Include="..\Apache.Ignite.log4net\Apache.Ignite.Log4Net.csproj">
+      <Project>{6F82D669-382E-4435-8092-68C4440146D8}</Project>
+      <Name>Apache.Ignite.Log4Net</Name>
+    </ProjectReference>
     <ProjectReference Include="..\Apache.Ignite.NLog\Apache.Ignite.NLog.csproj">
       <Project>{C6B58E4A-A2E9-4554-AD02-68CE6DA5CFB7}</Project>
       <Name>Apache.Ignite.NLog</Name>

http://git-wip-us.apache.org/repos/asf/ignite/blob/02f48d72/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/Log4NetLoggerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/Log4NetLoggerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/Log4NetLoggerTest.cs
new file mode 100644
index 0000000..2b28439
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/Log4NetLoggerTest.cs
@@ -0,0 +1,188 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Tests.Log
+{
+    using System;
+    using System.Collections.Generic;
+    using System.Globalization;
+    using System.Linq;
+    using Apache.Ignite.Core.Log;
+    using Apache.Ignite.Log4Net;
+    using global::log4net;
+    using global::log4net.Appender;
+    using global::log4net.Core;
+    using global::log4net.Repository.Hierarchy;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests for <see cref="IgniteLog4NetLogger"/>.
+    /// </summary>
+    public class Log4NetLoggerTest
+    {
+        /// <summary>
+        /// Tests the log level conversion.
+        /// </summary>
+        [Test]
+        public void TestLogLevelConversion()
+        {
+            var levels = new[] { LogLevel.Trace, LogLevel.Info, LogLevel.Debug, LogLevel.Warn,
LogLevel.Error };
+
+            foreach (var igniteLevel in levels)
+            {
+                var log4NetLevel = IgniteLog4NetLogger.ConvertLogLevel(igniteLevel);
+
+                Assert.AreEqual(igniteLevel.ToString().ToUpperInvariant(), log4NetLevel.ToString());
+            }
+        }
+
+        /// <summary>
+        /// Tests the logger in isolated environment.
+        /// </summary>
+        [Test]
+        public void TestLogging()
+        {
+            var memoryLog = CreateMemoryLogger();
+            var logger = new IgniteLog4NetLogger();
+
+            Func<LoggingEvent> getLastLog = () => memoryLog.PopAllEvents().Single();
+
+            // All parameters.
+            logger.Log(LogLevel.Trace, "msg{0}", new object[] { 1 }, CultureInfo.InvariantCulture,
"category",
+                "java-err", new Exception("myException"));
+
+            var log = getLastLog();
+            Assert.AreEqual("msg1", log.MessageObject.ToString());
+            Assert.AreEqual("category", log.LoggerName);
+            Assert.AreEqual("java-err", log.Properties["nativeErrorInfo"]);
+            Assert.AreEqual("myException", log.ExceptionObject.Message);
+            Assert.AreEqual(Level.Trace, log.Level);
+
+            // No Java error.
+            logger.Log(LogLevel.Info, "msg{0}", new object[] { 1 }, CultureInfo.InvariantCulture,
"category",
+                null, new Exception("myException"));
+
+            log = getLastLog();
+            Assert.AreEqual("msg1", log.MessageObject.ToString());
+            Assert.AreEqual("category", log.LoggerName);
+            Assert.AreEqual(null, log.Properties["nativeErrorInfo"]);
+            Assert.AreEqual("myException", log.ExceptionObject.Message);
+            Assert.AreEqual(Level.Info, log.Level);
+
+            // No exception.
+            logger.Log(LogLevel.Debug, "msg{0}", new object[] { 1 }, CultureInfo.InvariantCulture,
"category",
+                null, null);
+
+            log = getLastLog();
+            Assert.AreEqual("msg1", log.MessageObject.ToString());
+            Assert.AreEqual("category", log.LoggerName);
+            Assert.AreEqual(null, log.Properties["nativeErrorInfo"]);
+            Assert.AreEqual(null, log.ExceptionObject);
+            Assert.AreEqual(Level.Debug, log.Level);
+
+            // No params.
+            logger.Log(LogLevel.Warn, "msg{0}", null, CultureInfo.InvariantCulture, "category",
null, null);
+
+            log = getLastLog();
+            Assert.AreEqual("msg{0}", log.MessageObject.ToString());
+            Assert.AreEqual("category", log.LoggerName);
+            Assert.AreEqual(null, log.Properties["nativeErrorInfo"]);
+            Assert.AreEqual(null, log.ExceptionObject);
+            Assert.AreEqual(Level.Warn, log.Level);
+
+            // No formatter.
+            logger.Log(LogLevel.Error, "msg{0}", null, null, "category", null, null);
+
+            log = getLastLog();
+            Assert.AreEqual("msg{0}", log.MessageObject.ToString());
+            Assert.AreEqual("category", log.LoggerName);
+            Assert.AreEqual(null, log.Properties["nativeErrorInfo"]);
+            Assert.AreEqual(null, log.ExceptionObject);
+            Assert.AreEqual(Level.Error, log.Level);
+
+            // No category.
+            logger.Log(LogLevel.Error, "msg{0}", null, null, null, null, null);
+
+            log = getLastLog();
+            Assert.AreEqual("msg{0}", log.MessageObject.ToString());
+            Assert.AreEqual(null, log.LoggerName);
+            Assert.AreEqual(null, log.Properties["nativeErrorInfo"]);
+            Assert.AreEqual(null, log.ExceptionObject);
+            Assert.AreEqual(Level.Error, log.Level);
+
+            // No message.
+            logger.Log(LogLevel.Error, null, null, null, null, null, null);
+
+            log = getLastLog();
+            Assert.AreEqual(null, log.MessageObject);
+            Assert.AreEqual(null, log.LoggerName);
+            Assert.AreEqual(null, log.Properties["nativeErrorInfo"]);
+            Assert.AreEqual(null, log.ExceptionObject);
+            Assert.AreEqual(Level.Error, log.Level);
+        }
+
+        /// <summary>
+        /// Tests the logger with Ignite.
+        /// </summary>
+        [Test]
+        public void TestIgniteStartup()
+        {
+            var memoryLog = CreateMemoryLogger();
+            var logger = new IgniteLog4NetLogger();
+
+            var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
+            {
+                Logger = logger
+            };
+
+            Func<IEnumerable<string>> getLogs = () => memoryLog.GetEvents().Select(x
=> x.MessageObject.ToString());
+
+            using (var ignite = Ignition.Start(cfg))
+            {
+                Assert.IsTrue(getLogs().Contains(
+                    string.Format("Starting Ignite.NET {0}", typeof(Ignition).Assembly.GetName().Version)));
+
+                Assert.IsTrue(getLogs().Any(x => x.Contains(">>> Topology snapshot.")));
+
+                Assert.IsInstanceOf<IgniteLog4NetLogger>(ignite.Logger);
+
+                ignite.Logger.Info("Log from user code.");
+
+                Assert.IsTrue(getLogs().Contains("Log from user code."));
+            }
+
+            Assert.IsTrue(getLogs().Contains("Grid is stopping."));
+        }
+
+        /// <summary>
+        /// Creates the memory logger.
+        /// </summary>
+        private static MemoryAppender CreateMemoryLogger()
+        {
+            var hierarchy = (Hierarchy) LogManager.GetRepository();
+
+            var memory = new MemoryAppender();
+            memory.ActivateOptions();
+            hierarchy.Root.AddAppender(memory);
+
+            hierarchy.Root.Level = Level.All;
+            hierarchy.Configured = true;
+
+            return memory;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/02f48d72/modules/platforms/dotnet/Apache.Ignite.Core.Tests/packages.config
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/packages.config b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/packages.config
new file mode 100644
index 0000000..d369a35
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/packages.config
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  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.
+-->
+
+<packages>
+  <package id="NUnit.Runners" version="2.6.3" targetFramework="net40" />
+  <package id="log4net" version="2.0.5" targetFramework="net40" />
+  <package id="NLog" version="4.3.7" targetFramework="net40" />
+</packages>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/02f48d72/modules/platforms/dotnet/Apache.Ignite.Log4Net/Apache.Ignite.Log4Net.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Log4Net/Apache.Ignite.Log4Net.csproj b/modules/platforms/dotnet/Apache.Ignite.Log4Net/Apache.Ignite.Log4Net.csproj
new file mode 100644
index 0000000..0fdd611
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Log4Net/Apache.Ignite.Log4Net.csproj
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"
Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"
/>
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{6F82D669-382E-4435-8092-68C4440146D8}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Apache.Ignite.Log4Net</RootNamespace>
+    <AssemblyName>Apache.Ignite.Log4Net</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <RunCodeAnalysis>true</RunCodeAnalysis>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup>
+    <SignAssembly>true</SignAssembly>
+  </PropertyGroup>
+  <PropertyGroup>
+    <AssemblyOriginatorKeyFile>Apache.Ignite.Log4Net.snk</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a,
processorArchitecture=MSIL">
+      <HintPath>..\packages\log4net.2.0.5\lib\net40-full\log4net.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="IgniteLog4NetLogger.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\Apache.Ignite.Core\Apache.Ignite.Core.csproj">
+      <Project>{4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}</Project>
+      <Name>Apache.Ignite.Core</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Apache.Ignite.Log4Net.snk" />
+    <None Include="Apache.Ignite.Log4Net.nuspec" />
+    <None Include="packages.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and
uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/02f48d72/modules/platforms/dotnet/Apache.Ignite.Log4Net/Apache.Ignite.Log4Net.nuspec
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Log4Net/Apache.Ignite.Log4Net.nuspec b/modules/platforms/dotnet/Apache.Ignite.Log4Net/Apache.Ignite.Log4Net.nuspec
new file mode 100644
index 0000000..fa5c39a
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Log4Net/Apache.Ignite.Log4Net.nuspec
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+
+<!--
+  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.
+-->
+
+<!-- 
+
+Creating NuGet package:
+1) Build Apache.Ignite.sln (AnyCPU configuration)
+2) Create package (use csproj instead of nuspec so that template substitution works): 
+   nuget pack Apache.Ignite.Log4Net.csproj -Prop Configuration=Release -Prop Platform=AnyCPU
+
+-->
+
+<package >
+    <metadata>
+        <id>Apache.Ignite.Log4Net</id>
+        <title>Apache Ignite log4net Logger</title>
+        <!-- -->
+        <version>$version$</version>
+        <authors>Apache Ignite</authors>
+        <owners>Apache Software Foundation</owners>
+        <licenseUrl>http://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
+        <projectUrl>https://ignite.apache.org/</projectUrl>
+        <iconUrl>https://ignite.apache.org/images/logo_ignite_32_32.png</iconUrl>
+        <requireLicenseAcceptance>false</requireLicenseAcceptance>
+        <description>log4net Logger for Apache Ignite</description>
+        <releaseNotes></releaseNotes>
+        <copyright>Copyright 2016</copyright>
+        <tags>Apache Ignite In-Memory Distributed Computing SQL NoSQL LINQ Grid Map
Reduce Cache log4net logger</tags>
+        <dependencies>
+            <dependency id="Apache.Ignite" version="[$version$]" />
+            <dependency id="log4net" version="[2.0.0, 3.0.0)" />
+        </dependencies>    
+    </metadata>
+</package>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/02f48d72/modules/platforms/dotnet/Apache.Ignite.Log4Net/Apache.Ignite.Log4Net.snk
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Log4Net/Apache.Ignite.Log4Net.snk b/modules/platforms/dotnet/Apache.Ignite.Log4Net/Apache.Ignite.Log4Net.snk
new file mode 100644
index 0000000..a4d1622
Binary files /dev/null and b/modules/platforms/dotnet/Apache.Ignite.Log4Net/Apache.Ignite.Log4Net.snk
differ

http://git-wip-us.apache.org/repos/asf/ignite/blob/02f48d72/modules/platforms/dotnet/Apache.Ignite.Log4Net/IgniteLog4NetLogger.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Log4Net/IgniteLog4NetLogger.cs b/modules/platforms/dotnet/Apache.Ignite.Log4Net/IgniteLog4NetLogger.cs
new file mode 100644
index 0000000..058176f
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Log4Net/IgniteLog4NetLogger.cs
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Log4Net
+{
+    using System;
+    using Apache.Ignite.Core.Impl.Common;
+    using Apache.Ignite.Core.Log;
+    using global::log4net;
+    using global::log4net.Core;
+    using global::log4net.Util;
+    using ILogger = Apache.Ignite.Core.Log.ILogger;
+
+    /// <summary>
+    /// Ignite log4net integration.
+    /// </summary>
+    public class IgniteLog4NetLogger : ILogger
+    {
+        /** Wrapped log4net log. */
+        private readonly ILog _log;
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="IgniteLog4NetLogger"/> class.
+        /// </summary>
+        public IgniteLog4NetLogger() : this (LogManager.GetLogger(typeof(IgniteLog4NetLogger)))
+        {
+            // No-op.
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="IgniteLog4NetLogger"/> class.
+        /// </summary>
+        /// <param name="log">The log.</param>
+        public IgniteLog4NetLogger(ILog log)
+        {
+            IgniteArgumentCheck.NotNull(log, "log");
+
+            _log = log;
+        }
+
+        /// <summary>
+        /// Logs the specified message.
+        /// </summary>
+        /// <param name="logLevel">The level.</param>
+        /// <param name="message">The message.</param>
+        /// <param name="args">The arguments to format <paramref name="message"
/>.
+        /// Can be null (formatting will not occur).</param>
+        /// <param name="formatProvider">The format provider. Can be null if <paramref
name="args" /> is null.</param>
+        /// <param name="category">The logging category name.</param>
+        /// <param name="nativeErrorInfo">The native error information.</param>
+        /// <param name="ex">The exception. Can be null.</param>
+        public void Log(LogLevel logLevel, string message, object[] args, IFormatProvider
formatProvider, 
+            string category, string nativeErrorInfo, Exception ex)
+        {
+            var level = ConvertLogLevel(logLevel);
+
+            var repo = _log.Logger.Repository;
+
+            var messageObject = args == null 
+                ? (object) message 
+                : new SystemStringFormat(formatProvider, message, args);
+
+            var evt = new LoggingEvent(GetType(), repo, category, level, messageObject, ex);
+
+            if (nativeErrorInfo != null)
+                evt.Properties["nativeErrorInfo"] = nativeErrorInfo;
+
+            _log.Logger.Log(evt);
+        }
+
+        /// <summary>
+        /// Determines whether the specified log level is enabled.
+        /// </summary>
+        /// <param name="logLevel">The level.</param>
+        /// <returns>
+        /// Value indicating whether the specified log level is enabled
+        /// </returns>
+        public bool IsEnabled(LogLevel logLevel)
+        {
+            var level = ConvertLogLevel(logLevel);
+
+            return _log.Logger.IsEnabledFor(level);
+        }
+
+        /// <summary>
+        /// Converts the Ignite LogLevel to the log4net log level.
+        /// </summary>
+        /// <param name="level">The Ignite log level.</param>
+        /// <returns>Corresponding log4net log level.</returns>
+        public static Level ConvertLogLevel(LogLevel level)
+        {
+            switch (level)
+            {
+                case LogLevel.Trace:
+                    return Level.Trace;
+                case LogLevel.Debug:
+                    return Level.Debug;
+                case LogLevel.Info:
+                    return Level.Info;
+                case LogLevel.Warn:
+                    return Level.Warn;
+                case LogLevel.Error:
+                    return Level.Error;
+                default:
+                    throw new ArgumentOutOfRangeException("level", level, null);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/02f48d72/modules/platforms/dotnet/Apache.Ignite.Log4Net/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Log4Net/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.Log4Net/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..bb8e830
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Log4Net/Properties/AssemblyInfo.cs
@@ -0,0 +1,40 @@
+/*
+* 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.
+*/
+
+using System;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("Apache.Ignite.Log4Net")]
+[assembly: AssemblyDescription("Apache Ignite.NET log4net integration.")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Apache Software Foundation")]
+[assembly: AssemblyProduct("Apache Ignite.NET")]
+[assembly: AssemblyCopyright("Copyright ©  2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("6f82d669-382e-4435-8092-68c4440146d8")]
+
+[assembly: AssemblyVersion("1.8.0.14218")]
+[assembly: AssemblyFileVersion("1.8.0.14218")]
+[assembly: AssemblyInformationalVersion("1.8.0")]
+
+[assembly: CLSCompliant(true)]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/02f48d72/modules/platforms/dotnet/Apache.Ignite.Log4Net/packages.config
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Log4Net/packages.config b/modules/platforms/dotnet/Apache.Ignite.Log4Net/packages.config
new file mode 100644
index 0000000..e1e44b8
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Log4Net/packages.config
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  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.
+-->
+<packages>
+  <package id="log4net" version="2.0.5" targetFramework="net40" />
+</packages>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/02f48d72/modules/platforms/dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs
index baaa60d..50220d2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs
@@ -24,7 +24,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("Apache Software Foundation")]
 [assembly: AssemblyProduct("Apache Ignite.NET")]
-[assembly: AssemblyCopyright("Copyright ©  2015")]
+[assembly: AssemblyCopyright("Copyright ©  2016")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/02f48d72/modules/platforms/dotnet/Apache.Ignite.sln
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.sln b/modules/platforms/dotnet/Apache.Ignite.sln
index 2978780..de7cf19 100644
--- a/modules/platforms/dotnet/Apache.Ignite.sln
+++ b/modules/platforms/dotnet/Apache.Ignite.sln
@@ -36,9 +36,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.Linq",
"Apach
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.AspNet", "Apache.Ignite.AspNet\Apache.Ignite.AspNet.csproj",
"{13EA96FC-CC83-4164-A7C0-4F30ED797460}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.NLog", "Apache.Ignite.NLog\Apache.Ignite.NLog.csproj",
"{C6B58E4A-A2E9-4554-AD02-68CE6DA5CFB7}"
+EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.AspNet.Tests", "Apache.Ignite.AspNet.Tests\Apache.Ignite.AspNet.Tests.csproj",
"{18EA4C71-A11D-4AB1-8042-418F7559D84F}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.NLog", "Apache.Ignite.NLog\Apache.Ignite.NLog.csproj",
"{C6B58E4A-A2E9-4554-AD02-68CE6DA5CFB7}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.Log4Net", "Apache.Ignite.log4net\Apache.Ignite.Log4Net.csproj",
"{6F82D669-382E-4435-8092-68C4440146D8}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -202,6 +204,18 @@ Global
 		{C6B58E4A-A2E9-4554-AD02-68CE6DA5CFB7}.Release|x64.Build.0 = Release|Any CPU
 		{C6B58E4A-A2E9-4554-AD02-68CE6DA5CFB7}.Release|x86.ActiveCfg = Release|Any CPU
 		{C6B58E4A-A2E9-4554-AD02-68CE6DA5CFB7}.Release|x86.Build.0 = Release|Any CPU
+		{6F82D669-382E-4435-8092-68C4440146D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{6F82D669-382E-4435-8092-68C4440146D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{6F82D669-382E-4435-8092-68C4440146D8}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{6F82D669-382E-4435-8092-68C4440146D8}.Debug|x64.Build.0 = Debug|Any CPU
+		{6F82D669-382E-4435-8092-68C4440146D8}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{6F82D669-382E-4435-8092-68C4440146D8}.Debug|x86.Build.0 = Debug|Any CPU
+		{6F82D669-382E-4435-8092-68C4440146D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{6F82D669-382E-4435-8092-68C4440146D8}.Release|Any CPU.Build.0 = Release|Any CPU
+		{6F82D669-382E-4435-8092-68C4440146D8}.Release|x64.ActiveCfg = Release|Any CPU
+		{6F82D669-382E-4435-8092-68C4440146D8}.Release|x64.Build.0 = Release|Any CPU
+		{6F82D669-382E-4435-8092-68C4440146D8}.Release|x86.ActiveCfg = Release|Any CPU
+		{6F82D669-382E-4435-8092-68C4440146D8}.Release|x86.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE


Mime
View raw message