If you are using LoggerManager it is fairly straightforward.

Category log4jCategory = org.apache.log4j.Logger.getLogger("yourcategory");
Log4JLogger log4JLogger = new Log4JLogger(log4jCategory);
Logger log = Logger.getLogger("yourcategory");
Hierarchy hierarchy = new Hierarchy(log);
Log4JLoggerManager loggerManager = new Log4JLoggerManager("yourdefaultcategory", hierarchy, log4JLogger);
mycomponent.setLoggerManager(loggerManager);

if you are using LogKitManageable, it is slightly more complicated. I create two new classes from LogKit2AvalonLoggerAdapter and Logger2LogKitManager that were both public with otherwise identical code. Then added the following code to my app:

Logger2LogKitManager logKitManager = new Logger2LogKitManager(loggerManager);
mycomponent.setLogKitManager(logKitManager);
mycomponent.enableLogging(log4JLogger);

There might be a batter way to do this, but this worked for me with Cocoon. Hope it helps.
Brian

On Friday, January 24, 2003, at 03:51 PM, Quinton McCombs wrote:

Is there any way to use Log4J logging?

I am going through the example in "Developing with Apache Avalon" in the
section where you are creating the ContainerComponent.

The example has the following code:

this.manager.setLogger( ... );
this.cmanager.contextualize( ... );

I noticed that ExcaliburComponentManager had other methods such as
setLogKitManager()... I then found Log4JLoggerManager.... It appears
that *maybe* I can give ExcaliburComponentManager a logger which will
use Log4J?



--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to