You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Vincent Massol <vm...@octo.com> on 2001/11/18 13:42:22 UTC

[framework/excalibur] how do I use log4j ?

Hi,

I'd like to know if it is possible to use Log4j with Excalibur component
manager. The answer is probably no in the current version.
ExcaliburComponentManager extends AbstractLoggable which uses logkit classes
(it extends Loggable and not LogEnabled). BTW, I find it a pity that we had
to use the name LogEnabled where Loggable seems a much better name to me (I
know we need to pay attention to existing users).

My problem is that on the current project I am working, if  I cannot make
all avalon components (that we need) perform logging with Log4j, we probably
won't be able to adopt Avalon ... [They have standardized on Log4j for
logging (and have been developing for 1 year) and I'm trying to bring Avalon
to help develop properly the code (best patterns) and also transform it to
unit testable code using mock object strategy].

It seems to me that you were previously using LogKit and are now moving to
be implementation neutral (log4j, logkit, jdk1.4, ...). However, it seels
there are sill a lot of places where  logkit dependencies remain. Is that
right ?

What do you think about having an AbstractLogEnabled class that would
extends AbstractLoggable but also implement LogEnabled ? And then, for all
components, replace "extends AbstractLoggable" by "extends
AbstractLogEnabled" ? And deprecate Loggable and AbstractLoggable ?

I'm sure you have already discussed this subject at length so I hope I'm not
covering already decided grounds. I have to admit I have not spent too much
time going throught the previous month posts (I have just started looking at
avalon during the past 2 weeks).

Thanks
-Vincent




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [repost:framework/excalibur] how do I use log4j ?

Posted by Peter Donald <pe...@apache.org>.
On Tue, 20 Nov 2001 22:42, Vincent Massol wrote:
> I'd like to know if it is possible to use Log4j with Excalibur component
> manager. The answer is probably no in the current version.

as far as I can tell - yep ;(

> ExcaliburComponentManager extends AbstractLoggable which uses logkit
> classes (it extends Loggable and not LogEnabled).

right.

> BTW, I find it a pity
> that we had to use the name LogEnabled where Loggable seems a much better
> name to me (I know we need to pay attention to existing users).

me too. Oh well there is always Avalon/Framework 5 in a year or two ;)

> My problem is that on the current project I am working, if  I cannot make
> all avalon components (that we need) perform logging with Log4j, we
> probably won't be able to adopt Avalon ... [They have standardized on Log4j
> for logging (and have been developing for 1 year) and I'm trying to bring
> Avalon to help develop properly the code (best patterns) and also transform
> it to unit testable code using mock object strategy].
>
> It seems to me that you were previously using LogKit and are now moving to
> be implementation neutral (log4j, logkit, jdk1.4, ...). However, it seels
> there are sill a lot of places where  logkit dependencies remain. Is that
> right ?

yep.

> What do you think about having an AbstractLogEnabled class that would
> extends AbstractLoggable but also implement LogEnabled ? And then, for all
> components, replace "extends AbstractLoggable" by "extends
> AbstractLogEnabled" ? And deprecate Loggable and AbstractLoggable ?

-1 on AbstractLogEnabled extending AbstractLoggable 

Just seems like a bad design choice to me.

> I'm sure you have already discussed this subject at length so I hope I'm
> not covering already decided grounds. I have to admit I have not spent too
> much time going throught the previous month posts (I have just started
> looking at avalon during the past 2 weeks).

I don't actually use the component so take this with a grain of salt ... but 
I think that the main reason that Loggable is still used is because some of 
the components created by the ComponentManager are Loggable themselves. As it 
is impossible to get the logkit.Logger from the framework.logger.Logger we 
still need to pass around the logkit.Logger so that the Loggable components 
will still get old style Loggers.

One way to work around this is the following. It is probably a bit of work 
and it is definetly ugly but it should work while we need to maintain 
backwards compatability.

All the objects in the component.* package become both Loggable and 
LogEnabled. If they are passed a LogKit logger then they cache it and then 
wrap it and pass it to the framework LogEnabled interface. When you 
create/configure/whatever a component inside the ExcaliburComponentManager 
you first check if it is Loggable. If the created component is Loggable and 
you have no LogKit logger instance (ie you were configured using LogEnabled) 
then you throw an IllegalStateException. 

This should be able to be implemented. You will still need logkit.jar on the 
classpath when using it but you wont need to actually use it. Kinda hacky but 
it would get what you want.

Disclaimer: haven't looked at code in ages and don't use it regularly ;)


-- 
Cheers,

Pete

------------------------------------
The two secrets to success:
   1- Don't tell anyone everything.
------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


[repost:framework/excalibur] how do I use log4j ?

Posted by Vincent Massol <vm...@octo.com>.
Hi,

I'd like to know if it is possible to use Log4j with Excalibur component
manager. The answer is probably no in the current version.
ExcaliburComponentManager extends AbstractLoggable which uses logkit classes
(it extends Loggable and not LogEnabled). BTW, I find it a pity that we had
to use the name LogEnabled where Loggable seems a much better name to me (I
know we need to pay attention to existing users).

My problem is that on the current project I am working, if  I cannot make
all avalon components (that we need) perform logging with Log4j, we probably
won't be able to adopt Avalon ... [They have standardized on Log4j for
logging (and have been developing for 1 year) and I'm trying to bring Avalon
to help develop properly the code (best patterns) and also transform it to
unit testable code using mock object strategy].

It seems to me that you were previously using LogKit and are now moving to
be implementation neutral (log4j, logkit, jdk1.4, ...). However, it seels
there are sill a lot of places where  logkit dependencies remain. Is that
right ?

What do you think about having an AbstractLogEnabled class that would
extends AbstractLoggable but also implement LogEnabled ? And then, for all
components, replace "extends AbstractLoggable" by "extends
AbstractLogEnabled" ? And deprecate Loggable and AbstractLoggable ?

I'm sure you have already discussed this subject at length so I hope I'm not
covering already decided grounds. I have to admit I have not spent too much
time going throught the previous month posts (I have just started looking at
avalon during the past 2 weeks).

Thanks
-Vincent



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>