NHibernate Forge
The official new home for the NHibernate for .NET community

Comments: Using NLog via Common.Logging with NHibernate

Wiki Page Hierarchy

Pages

Page Details

First published by:
Matthias Gernand
on 08-16-2010
Last revision by:
Matthias Gernand
on 09-27-2010
3 people found this article useful.
Comments (6)
History (11)

Using NLog via Common.Logging with NHibernate

Sort by: Published Date | Most Recent | Most Useful
1 2 Next >
By: Fabio Maulo Posted on 08-16-2010 18:53
100% of people found this useful

Can I use it with NHibernate 3.0.0.Alpha2 and above or only with the trunk ?

By: Matthias Gernand Posted on 08-17-2010 15:47

The Current available version is built against NH3 Trunk (rev. 5262).

Unfortunately there is no 3.0.0.Alpha2 Tag in the NH3 Repository.

The download contains a demo console app, so you may replace the provided NHibernate.dll

with the version you like and try the demo app.

By: Fabio Maulo Posted on 08-27-2010 8:36

For NH3.0Alpha2 you can download binaries.

btw my question is about the content of the wiki.

Can I use it with NHibernate 3.0.0.Alpha2 and above or only with the trunk ?

By: Matthias Gernand Posted on 12-19-2010 8:48

After the release of NH 3.0.0-GA I have created a corresponding realease for the Common.Logging provider. You can find the release on Codeplex: nhlogging.codeplex.com/.../56937

By: Daniel Lidstrom Posted on 01-23-2011 18:17

The configuration example is wrong. Here's a complete example that works (for a console application):

<?xml version="1.0"?>

<configuration>

 <configSections>

   <sectionGroup name="common">

     <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />

   </sectionGroup>

   <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>

 </configSections>

 <common>

   <logging>

     <factoryAdapter type="Common.Logging.NLog.NLogLoggerFactoryAdapter, Common.Logging.NLog">

       <arg key="configType" value="INLINE" />

     </factoryAdapter>

   </logging>

 </common>

 <nlog xmlns="www.nlog-project.org/.../NLog.xsd"

       xmlns:xsi="www.w3.org/.../XMLSchema-instance">

   <targets>

     <target name="console" xsi:type="Console" layout="${date:format=HH\:MM\:ss} ${logger} ${message}" />

   </targets>

   <rules>

     <logger name="*" minlevel="Debug" writeTo="console" />

   </rules>

 </nlog>

 <appSettings>

   <add key="nhibernate-logger" value="NHibernate.Logging.CommonLogging.CommonLoggingLoggerFactory, NHibernate.Logging.CommonLogging" />

 </appSettings>

</configuration>

The above is configured for NLog. You need the following assemblies in your bin:

Common.Logging.dll

Common.Logging.NLog.dll

NHibernate.Logging.CommonLogging.dll

NLog.dll

Daniel

Powered by Community Server (Commercial Edition), by Telligent Systems