Hi,
I just wanted to float the idea of using a Common.Logging abstraction for NHibernate.
http://netcommon.sourceforge.net/index.html
Personally, I've been frustrated by NHibernate's dependency on log4net for a long time. I use NLog for all my logging in all my apps, and it would be nice to consolidate NHibernate's logging onto the same logging infrastructure that my application uses.
I don't see any benefit of having two separate logging infrastructures and I think NH developers should have the freedom to choose their logging implementation.
Benefits are:
1) I can configure the logging in NHibernate to use log4net or NLog.
2) We get more control over logging.
3) Impact of switching to Common.Logging should be minimal.
I just wanted to float the idea with all of you to gauge whether or not you like the idea. If it's worth exploring, I'll be willing to work on a patch with Common.Logging.
Thanks,
Brian
----------------------------------------------
Brian Chavez
Bit Armory, Inc.
http://www.bitarmory.com
Hi Fabio,
I totally understand you guys have other issues that have higher priority.
If I submit a patch for this, what "working base" should I make the patch from? SVN /trunk or off the latest offical src.zip release?
Thanks,
Brian
----------------------------------------------
Brian Chavez
Bit Armory, Inc.
http://www.bitarmory.com
To be honest - I'd have thought that writing a NLogAppender for
log4net might solve your problem a _lot_ easier. (Depending on what
exactly the problem is).
j.
I like the idea of making the logging pluggable, its sort of like the
idea of having a common standard interface for IoC containers so that
developers can bring their own IoC to the table and not be forced to
utilize multiple containers.
LogManager and ILog are (strikingly) identical between log4net and
Common.Logging, with one small exception.
log4net.ILog has format helper methods like DebugFormat(...);
Common.Logging.ILog does not define format helper methods. The interface
only defines:
public interface ILog
{
// Methods
void Debug(object message);
void Debug(object message, Exception exception);
void Error(object message);
void Error(object message, Exception exception);
void Fatal(object message);
void Fatal(object message, Exception exception);
void Info(object message);
void Info(object message, Exception exception);
void Trace(object message);
void Trace(object message, Exception exception);
void Warn(object message);
void Warn(object message, Exception exception);
// Properties
bool IsDebugEnabled { get; }
bool IsErrorEnabled { get; }
bool IsFatalEnabled { get; }
bool IsInfoEnabled { get; }
bool IsTraceEnabled { get; }
bool IsWarnEnabled { get; }
}
The format helpers are used throughout NH. Any thoughts on how to (or not)
proceed?
----------------------------------------------
Brian Chavez
Bit Armory, Inc.
http://www.bitarmory.com
Exactly - there are two separate ideas here:
1. NH-Devs - Removing static third party dependancies.
2. Brian - Allowing using other logging frameworks.
Replacing a hard dependancy on log4net with one on Common.Logging
isn't really a huge win for 1 - but it might be for 2.
j.
If NHUsers don't want (or use) any of the logging frameworks mentioned, they
can implement their own ILoggerFractoryAdapter that will work just the same.
This is the fundamental purpose of Common.Logging.
http://netcommon.sourceforge.net/doc-latest/reference/html/logging.html
I guess if you want to break the dependency on log4net AND keep
Common.Logging out all together, then NH needs its own Logging that is
pluggable.
Possibly, a NHibernate.Logging namespace with some interfaces that NHUsers
can implement, and a LoggerFactory type that can be defined in an NH Config
File. However, I think this approach is basically reinventing the wheel
because Common.Logging already has this functionality.
-Brian
----------------------------------------------
Brian Chavez
Bit Armory, Inc.
http://www.bitarmory.com
-----Original Message-----
From: nhibernate-...@googlegroups.com
[mailto:nhibernate-...@googlegroups.com] On Behalf Of josh robb
Sent: Sunday, October 26, 2008 4:37 AM
To: nhibernate-...@googlegroups.com
Subject: [nhibernate-development] Re: NH Logging Abstraction
A lot people say that the only reason they using log4net is because a
lot of library's use log4net too. But they find the configuration of
NLog much better then log4net.
So a switch to Common.Logging or i little custom wrapper is a good
suggestion i think.
Steve
----------------------------------------------
Brian Chavez
Bit Armory, Inc.
http://www.bitarmory.com
From: nhibernate-...@googlegroups.com
[mailto:nhibernate-...@googlegroups.com] On Behalf Of Fabio
Maulo
Sent: Tuesday, October 28, 2008 5:42 AM
To: nhibernate-...@googlegroups.com
Subject: [nhibernate-development] Re: NH Logging Abstraction
Yes, Steve.
Well, the last release for log4net (1.2.10) was sometime in 2006 according to:
http://svn.apache.org/viewvc?view=rev&sortdir=down&revision=395324
http://jira.nhibernate.org/browse/NH-696
The last release for NLog was also in 2006.
I suppose, the release cycle for logging frameworks don't change much.
I'll shoot an email over to their mailing list to see if their still active.
----------------------------------------------
Brian Chavez
Bit Armory, Inc.
http://www.bitarmory.com
And then there could be a contrib project which provides adapters for
log4net and NLog. And all are happy :-)
Tuna Toksöz schrieb:
> Well, we'll anyway need to abstract it, we'd prefer dependency only on .net
> FW.
>
>
> On Tue, Oct 28, 2008 at 10:47 PM, Brian Chavez <bch...@bitarmory.com>wrote:
>
>> Well, the last release for log4net (1.2.10) was sometime in 2006
>> according to:
>>
>>
>>
>> http://svn.apache.org/viewvc?view=rev&sortdir=down&revision=395324
>>
>>
>>
>> http://jira.nhibernate.org/browse/NH-696
>>
>>
>>
>> The last release for NLog was also in 2006.
>>
>>
>>
>> I suppose, the release cycle for logging frameworks don't change much.
>>
>>
>>
>> I'll shoot an email over to their mailing list to see if their still
>> active.
>>
>>
>>
>>
>> ----------------------------------------------
>> Brian Chavez
>> Bit Armory, Inc.
>> http://www.bitarmory.com
>>
>>
>>
>> *From:* nhibernate-...@googlegroups.com [mailto:
>> nhibernate-...@googlegroups.com] *On Behalf Of *Tuna Toksöz
>> *Sent:* Tuesday, October 28, 2008 12:55 PM
>>
>> *To:* nhibernate-...@googlegroups.com
>> *Subject:* [nhibernate-development] Re: NH Logging Abstraction
>>
>>
>>
>> I don't know how much it is of importance but that project has its latest
>> release on 10/10/2007.
>>
>> What do you guys think, is it dead or active?
>>
>> On Tue, Oct 28, 2008 at 9:38 PM, Brian Chavez <bch...@bitarmory.com>
>> wrote:
>>
>> JIRA created:
>>
>>
>>
>> http://jira.nhibernate.org/browse/NH-1554
>>
>>
>>
>>
>>
>>
>> ----------------------------------------------
>> Brian Chavez
>> Bit Armory, Inc.
>> http://www.bitarmory.com
>>
>>
>>
>> *From:* nhibernate-...@googlegroups.com [mailto:
>> nhibernate-...@googlegroups.com] *On Behalf Of *Fabio Maulo
>> *Sent:* Tuesday, October 28, 2008 5:42 AM
>>
>>
>> *To:* nhibernate-...@googlegroups.com
>> *Subject:* [nhibernate-development] Re: NH Logging Abstraction
So maybe it would the best if the dependency of log4net gets removed and
would be replaced with a simple and similar interface which per default
redirects all logging to System.Diagnostics. So a logging without an
additional libs is possible.
And then there could be a contrib project which provides adapters for
log4net and NLog. And all are happy :-)
BTW Tuna, for what it's worth, I got a response from Common.Logging dev
list:
Hi,
Yes it is still active, I founded the project and do most of the
development, Bruno Baia is another developer on the project. I'd be quite
happy to use this opportunity to make a new release of Commons.Logging that
addresses the remaining open issues. Are there other feature requests that
would be specific to NHibernate adopting Common.Logging? As for the 'when',
starting in the 2nd week of November I'll have time to address these issues,
I don't think they will take long to fix.
Cheers,
Mark
----------------------------------------------
Brian Chavez
Bit Armory, Inc.
http://www.bitarmory.com
Yes, I'll be glad to work on a patch for System.Diagnostics Logging.
I just need some time to read up on System.Diag, think about correct implementation, and optimize a painless way to go about making the change. If I have any issues, I'll keep the list posted.
I have a commercial project due in a few weeks and will put some effort into logging soon after.
-Brian
----------------------------------------------
Brian Chavez
Bit Armory, Inc.
http://www.bitarmory.com