@Fabio
I meant a look up, as in the pattern desc original, instead of an IoC.
Something that gives a singleton logger, nothing big.

@Ayende

Why do you think it will create a huge amount of work, care to elaborate ?

Secondly, I don't think the abstraction is not required, first it will make
it possible to swap between loggers and log4net is not mandatory any more,
second, the configuration needed for Log4net, which is not a NH config, will
not be needed anymore, reducing unnecessary complexity and noise in config.

It is not that I am up to start a crusade against log4net, but I also think
that code will be in better shape with this abstraction provided over all
too.


On Sat, Mar 14, 2009 at 4:10 AM, Fabio Maulo <[email protected]> wrote:

> What you mean for "ServiceLocator" ?That word it is not so little...
>
>
> 2009/3/13 Sidar Ok <[email protected]>
>
>> So do you mean instead of a SL we need to use something like
>> Environment.GetLogger<T> and Environment.GetLogger(string) (1)? I proposed
>> the service locator because the current usage is like this as you know:
>>
>> protected static readonly ILog log =
>> LogManager.GetLogger(typeof(AbstractBatcher));
>>
>> So instead of using this static member we are going to use (1). Is my
>> understanding correct ? Environment seems a better place agreed, does that
>> mean that we should put custom configuration for it in place ?
>>
>> Also it might be valuable to have a NullLoger as default like
>> NullByteCodeProvider ?
>>
>>
>> On Sat, Mar 14, 2009 at 3:35 AM, Fabio Maulo <[email protected]>wrote:
>>
>>> Logger should be set before any other operation (as byte code). The
>>> instance should be find trough Environment.
>>>
>>> 2009/3/13 Sidar Ok <[email protected]>
>>>
>>> Hi Folks,
>>>>
>>>> I know this was discussed before :
>>>> http://groups.google.com/group/nhibernate-development/browse_thread/thread/cdfddb3b63307dab/661d2b44a2100f9astarted
>>>>  by Brian Chavez.
>>>>
>>>> As far as I can see in the trunk and in JIRA, there is no patch provided
>>>> and it has been quite a time after the last message. Now I am willing to 
>>>> put
>>>> some work in here to provide a patch, if it is OK.
>>>>
>>>> So here is my proposal step by step, let me know if it makes sense :
>>>>
>>>> 1 - Extract a new interface, called NHibernate.Logging.ILogger . This
>>>> interface will abstract 2 used versions of GetLogger(Type) and
>>>> GetLogger(string).
>>>> 2 - Put this behind a service locator and change all references to
>>>> logger to use this service locator instead, e.g :
>>>> ServiceLocator.Get<NHibernate.Logging.ILogger>(typeof(PocoInstantiator))
>>>> 3 - Remove all the assembly dependencies to log4net from the core and
>>>> move it to contrib (they might stay in tests though for convenience).
>>>> 4 - In contrib, implement a Log4NetLoggerProvider :
>>>> NHibernate.Logging.ILogger that simply is a wrapper over the log4net
>>>> implementation.
>>>>
>>>> In contrib we can also provide wrappers for NLog or EL Logging App
>>>> Block. So this will be a step forward to have NH to be dependent only .NET
>>>> FW by eliminating a hard dependency on log4net.
>>>>
>>>> Thoughts ?
>>>>
>>>> --
>>>> Sidar Ok
>>>>
>>>> http://www.sidarok.com
>>>> http://www.twitter.com/sidarok
>>>>
>>>>
>>>
>>>
>>> --
>>> Fabio Maulo
>>>
>>
>>
>>
>> --
>> Sidar Ok
>>
>> http://www.sidarok.com
>> http://www.twitter.com/sidarok
>>
>>
>
>
> --
> Fabio Maulo
>



-- 
Sidar Ok

http://www.sidarok.com
http://www.twitter.com/sidarok

Reply via email to