Skip to content

Commit

Permalink
Updated to NHibernate 5.0.3 and Common.Logging 3.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mgernand committed Mar 16, 2018
1 parent 6d0c488 commit 3100b52
Show file tree
Hide file tree
Showing 16 changed files with 236 additions and 114 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,6 @@ Generated_Code #added for RIA/Silverlight projects
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML

# Visual Studio folder
.vs
2 changes: 1 addition & 1 deletion Build/Build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<PropertyGroup>
<!-- Version properties -->
<Version>4.0.3</Version>
<Version>5.0.3</Version>
<!-- Override path to custom build tasks -->
<MSBuildCommunityTasksPath>..\Tools\MSBuild</MSBuildCommunityTasksPath>
<MSBuildCommunityTasksLib>MSBuild.Community.Tasks.dll</MSBuildCommunityTasksLib>
Expand Down
4 changes: 2 additions & 2 deletions Build/nhlogging.commonlogging.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<licenseUrl>https://github.com/mgernand/nhibernate-logging/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/mgernand/nhibernate-logging</projectUrl>
<dependencies>
<dependency id="Common.Logging" version="3.1.0" />
<dependency id="NHibernate" version="4.0.3.4000" />
<dependency id="Common.Logging" version="3.4.1" />
<dependency id="NHibernate" version="5.0.3" />
</dependencies>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>Connects NHibernate logging infrastructure to Common.Logging.</description>
Expand Down
24 changes: 9 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
NHibernate Logging Providers
============================
The current version **4.0.3** is available as [NuGet package](http://nuget.org/packages/NHibernate.Logging/).
This version is built against NHibernate 4.0.3 and Common.Logging 3.1.0.
The current version **5.0.3** is available as [NuGet package](http://nuget.org/packages/NHibernate.Logging/).
This version is built against NHibernate 5.0.3 and Common.Logging 3.4.1.

Project Description
-------------------
NHibernate Logging Providers makes it possible to use your favourite logger with NHibernate.
You no longer have to use log4net. The new NHibernate (since NH3) logging abstraction makes
this possible. The provider is developed in C# using .NET 4.5.
this possible. The provider is developed in C# using .NET 4.6.1.

Available Logging Providers
---------------------------
The current release contains log providers for the following logging frameworks.

* [Common.Logging 3.1.0](https://github.com/net-commons/common-logging)
* [Common.Logging 3.4.1](https://github.com/net-commons/common-logging)

Common.Logging 3.1.0 supports several other logging frameworks. So you can use
each of them with NHibernate via Common.Logging 3.1.0 abstraction.
Common.Logging 3.4.1 supports several other logging frameworks. So you can use
each of them with NHibernate via Common.Logging 3.4.1 abstraction.

Review the [NHibernate Wiki](http://nhibernate.info/doc/howto/various/using-nlog-via-common-logging-with-nhibernate.html) for additional informations. Please leave a comment if you
like it or not. ;-)
Expand All @@ -29,16 +29,10 @@ Thanks again for the effort.

Getting Started
---------------
To use the Common.Logging 3.1.0 logging abstraction framework with NHibernate all you have
to do is to copy the following Assemblies to you projects output directory:
Add the [NuGet package](http://nuget.org/packages/NHibernate.Logging/) to your project. Install
all nessessary Common.Logging packages for the Log ürovider you want to use.

* Common.Logging.dll
* Common.Logging.Core.dll
* NHibernate.Logging.CommonLogging.dll

Needless to say that you have to copy your loggers Assembly and the corresponding
Common.Logging-Provider Assembly too. To enable the log provider you have to add the
following lines to your Web.config or App.config:
To enable the log provider you have to add the following lines to your Web.config or App.config:

```xml
<appSettings>
Expand Down
17 changes: 13 additions & 4 deletions Source/Logging.Tests/CommonLogging/CommonLogMock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ internal class CommonLogMock : ILog
public int errorFormat;
public int fatal;
public int fatalException;
public int isTraceEnabled;
public int isDebugEnabled;
public int isInfoEnabled;
public int isWarnEnabled;
Expand Down Expand Up @@ -339,7 +340,11 @@ public void Fatal(IFormatProvider formatProvider, Action<FormatMessageHandler> f

public bool IsTraceEnabled
{
get { throw new NotImplementedException(); }
get
{
this.isTraceEnabled++;
return false;
}
}

public bool IsDebugEnabled
Expand Down Expand Up @@ -369,9 +374,6 @@ public bool IsWarnEnabled
}
}

public IVariablesContext GlobalVariablesContext { get; private set; }
public IVariablesContext ThreadVariablesContext { get; private set; }

public bool IsErrorEnabled
{
get
Expand All @@ -389,5 +391,12 @@ public bool IsFatalEnabled
return false;
}
}

public IVariablesContext GlobalVariablesContext { get; private set; }

public IVariablesContext ThreadVariablesContext { get; private set; }

/// <inheritdoc />
public INestedVariablesContext NestedThreadVariablesContext { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public void CallingMethods()
logMock.errorFormat.Should().Be(1);
logMock.fatal.Should().Be(1);
logMock.fatalException.Should().Be(1);
logMock.isTraceEnabled.Should().Be(1);
logMock.isDebugEnabled.Should().Be(1);
logMock.isInfoEnabled.Should().Be(1);
logMock.isWarnEnabled.Should().Be(1);
Expand Down
61 changes: 40 additions & 21 deletions Source/Logging.Tests/Logging.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit.3.10.1\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.10.1\build\NUnit.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand All @@ -10,11 +11,13 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Logging.Tests</RootNamespace>
<AssemblyName>Logging.Tests</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -36,34 +39,42 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Common.Logging">
<HintPath>..\packages\Common.Logging.3.1.0\lib\net35\Common.Logging.dll</HintPath>
<Reference Include="Antlr3.Runtime, Version=3.5.0.2, Culture=neutral, PublicKeyToken=eb42632606e9261f, processorArchitecture=MSIL">
<HintPath>..\packages\Antlr3.Runtime.3.5.1\lib\net40-client\Antlr3.Runtime.dll</HintPath>
</Reference>
<Reference Include="Common.Logging.Core">
<HintPath>..\packages\Common.Logging.Core.3.1.0\lib\net35\Common.Logging.Core.dll</HintPath>
<Reference Include="Common.Logging, Version=3.4.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
<HintPath>..\packages\Common.Logging.3.4.1\lib\net40\Common.Logging.dll</HintPath>
</Reference>
<Reference Include="Iesi.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Iesi.Collections.4.0.0.4000\lib\net40\Iesi.Collections.dll</HintPath>
<Reference Include="Common.Logging.Core, Version=3.4.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
<HintPath>..\packages\Common.Logging.Core.3.4.1\lib\net40\Common.Logging.Core.dll</HintPath>
</Reference>
<Reference Include="NHibernate">
<HintPath>..\packages\NHibernate.4.0.3.4000\lib\net40\NHibernate.dll</HintPath>
<Reference Include="Iesi.Collections, Version=4.0.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<HintPath>..\packages\Iesi.Collections.4.0.4\lib\net461\Iesi.Collections.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=2.0.1.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\NLog.3.2.1\lib\net35\NLog.dll</HintPath>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NHibernate, Version=5.0.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<HintPath>..\packages\NHibernate.5.0.3\lib\net461\NHibernate.dll</HintPath>
</Reference>
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.4.13\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="SharpTestsEx">
<HintPath>..\packages\SharpTestsEx.1.1.1\lib\SharpTestsEx.dll</HintPath>
<Reference Include="nunit.framework, Version=3.10.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.10.1\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="SharpTestsEx.Mvc">
<HintPath>..\packages\SharpTestsEx.1.1.1\lib\SharpTestsEx.Mvc.dll</HintPath>
<Reference Include="Remotion.Linq, Version=2.2.0.0, Culture=neutral, PublicKeyToken=fee00910d6e5f53b, processorArchitecture=MSIL">
<HintPath>..\packages\Remotion.Linq.2.2.0\lib\net45\Remotion.Linq.dll</HintPath>
</Reference>
<Reference Include="Remotion.Linq.EagerFetching, Version=2.1.0.0, Culture=neutral, PublicKeyToken=fee00910d6e5f53b, processorArchitecture=MSIL">
<HintPath>..\packages\Remotion.Linq.EagerFetching.2.1.0\lib\net45\Remotion.Linq.EagerFetching.dll</HintPath>
</Reference>
<Reference Include="SharpTestsEx, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SharpTestsEx.2.0.0\lib\net45\SharpTestsEx.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
</ItemGroup>
<ItemGroup>
<Compile Include="CommonLogging\CommonLoggingLoggerTest.cs" />
Expand All @@ -80,9 +91,17 @@
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NUnit.3.10.1\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.10.1\build\NUnit.props'))" />
</Target>
<!-- 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">
Expand Down
20 changes: 14 additions & 6 deletions Source/Logging.Tests/app.config
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-3.2.1.0" newVersion="3.2.1.0"/>
<assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.2.1.0" newVersion="3.2.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.0.4000" newVersion="4.0.0.4000"/>
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.4000" newVersion="4.0.0.4000" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Remotion.Linq" publicKeyToken="fee00910d6e5f53b" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.4000" newVersion="4.0.0.4000" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /></startup></configuration>
18 changes: 11 additions & 7 deletions Source/Logging.Tests/packages.config
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Common.Logging" version="3.1.0" targetFramework="net35" requireReinstallation="True" />
<package id="Common.Logging.Core" version="3.1.0" targetFramework="net35" requireReinstallation="True" />
<package id="Iesi.Collections" version="4.0.0.4000" targetFramework="net45" />
<package id="NHibernate" version="4.0.3.4000" targetFramework="net45" />
<package id="NLog" version="3.2.1" targetFramework="net35" requireReinstallation="True" />
<package id="NUnit" version="2.6.4" targetFramework="net35" />
<package id="SharpTestsEx" version="1.1.1" />
<package id="Antlr3.Runtime" version="3.5.1" targetFramework="net461" />
<package id="Common.Logging" version="3.4.1" targetFramework="net45" />
<package id="Common.Logging.Core" version="3.4.1" targetFramework="net45" />
<package id="Iesi.Collections" version="4.0.4" targetFramework="net461" />
<package id="Microsoft.CSharp" version="4.4.1" targetFramework="net461" />
<package id="NHibernate" version="5.0.3" targetFramework="net461" />
<package id="NLog" version="4.4.13" targetFramework="net45" />
<package id="NUnit" version="3.10.1" targetFramework="net461" />
<package id="Remotion.Linq" version="2.2.0" targetFramework="net461" />
<package id="Remotion.Linq.EagerFetching" version="2.1.0" targetFramework="net461" />
<package id="SharpTestsEx" version="2.0.0" targetFramework="net461" />
</packages>
38 changes: 36 additions & 2 deletions Source/LoggingExample/App.config
Original file line number Diff line number Diff line change
@@ -1,18 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<appSettings>
<add key="nhibernate-logger" value="NHibernate.Logging.CommonLogging.CommonLoggingLoggerFactory, NHibernate.Logging.CommonLogging" />
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
<bindingRedirect oldVersion="0.0.0.0-3.4.1.0" newVersion="3.4.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.2.1.0" newVersion="3.2.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Common.Logging.Core" publicKeyToken="af08829b84f0328e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.4.1.0" newVersion="3.4.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Remotion.Linq" publicKeyToken="fee00910d6e5f53b" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup></configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v13.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
<remove invariant="System.Data.SQLite" />
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
</DbProviderFactories>
</system.data>
</configuration>
Loading

0 comments on commit 3100b52

Please sign in to comment.