hi,
Leo Simons said:
Category log4jCategory = org.apache.log4j.Logger.getLogger("bla.dibla");
..............
ExcaliburComponentManager ecm = new ExcaliburComponentManager();
//there is a little error
ecm.setLogger( logger );
the right method is:
ecm.enableLogging(logger);
due to Loggable is setLogger( org.apache.log.Logger logger ),so avalon suggest
user LogEnabled instead of Loggable,now I can use this interface support log4j in my
project ,
anyway,Leo remind me,thanks
----- Original Message -----
From: "Leo Simons" <[EMAIL PROTECTED]>
To: "Avalon framework users" <[EMAIL PROTECTED]>
Sent: Thursday, July 04, 2002 4:14 PM
Subject: Re: How can I use Log4J in Excalibur-4.1?
> On Thu, 2002-07-04 at 05:52, yangjs wrote:
> > hi,all
> > The Excalibur-4.1 use LogKit ,I feel that this is a big fault in all avalon
> > project for me.Almost all my project already using Log4J,and now How can I
> > use Log4J in Excalibur-4.1 sub project ECM and so on...
>
> hi!
>
> Most of the avalon people think it is pretty smart to use LogKit...it
> has some really nice features.
>
> I won't bother you with the details though. You can use Log4J with
> avalon as well with just a little effort. We use an abstraction to
> support any logging implementation, which you can find out more about
> from the javadocs:
>
> http://jakarta.apache.org/avalon/api/index.html
>
> ECM extends AbstractLoggable:
>
>
>http://jakarta.apache.org/avalon/excalibur/component/api/org/apache/avalon/excalibur/component/ExcaliburComponentManager.html
>
>
> extends:
>
>
>http://jakarta.apache.org/avalon/api/org/apache/avalon/framework/logger/AbstractLoggable.html
>
>
> which defines a method setLogger() which you can use to customize the
> logger you wish to use, in your case
>
>
>http://jakarta.apache.org/avalon/api/org/apache/avalon/framework/logger/Log4JLogger.html
>
>
> so your code becomes, roughly:
>
> // get a log4j logger somewhere
> Category log4jCategory = org.apache.log4j.Logger.getLogger("bla.dibla");
>
> // use it to create an avalon framework logger
> org.apache.avalon.framework.logger.Logger logger =
> new org.apache.avalon.framework.logger.Log4JLogger( log4jCategory);
>
> // get your ECM instance
> ExcaliburComponentManager ecm = new ExcaliburComponentManager();
>
> // provide your logger
> ecm.setLogger( logger );
>
> and that should do it. I do not know much about ECM internals though, so
> if it doesn't work one of its authors will have to help you out =)
>
> Please let us know if this works (or doesn't work :/ ) for you!
>
> thanks,
>
> - Leo Simons
>
>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>