logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris D'Annunzio" <Chr...@verdiem.com>
Subject RE: Upgrading from 0.9.7 to 0.10.0 - Pool Information
Date Wed, 06 Aug 2008 18:16:08 GMT
Thanks for the reply Curt. I understand how it works now.


-----Original Message-----
From: Curt Arnold [mailto:carnold@apache.org] 
Sent: Monday, August 04, 2008 11:01 PM
To: Log4CXX User
Subject: Re: Upgrading from 0.9.7 to 0.10.0 - Pool Information

On Aug 1, 2008, at 4:39 PM, Chris D'Annunzio wrote:

> Hello,
> I am in the process of upgrading from version 0.9.7 to 0.10.0 of the  
> log4cxx library. I've successfully built the library and I am now in  
> the process of integrating into our product.
> Some of the methods that we were previously calling have a new  
> required log4cxx::helpers::Pool parameter. For example, we are  
> calling the activateOptions() method on an log4cxx::AppenderPtr.
> From what I can tell, this appears to be a memory pool interface  
> that log4cxx uses internally. What is the proper way to get this  
> Pool object? Am I supposed to create one myself during  
> initialization? I can't seem to find any mention of it in the  
> documentation.
> Any help would be greatly appreciated.
> Best Regards,
> Chris D'Annunzio

Pool parameters are a memory pool that is used for just that  
operation.  No memory or other resource from that pool is expected to  
live beyond the duration of the call.  You could either create a new  
subpool of the global pool for each call:

    log4cxx::helpers::Pool p;

or share the same pool between multiple calls:

    log4cxx::helpers::Pool p;
    //   whatever loop you may already have in your program
    for(std::vector<AppenderPtr>::interator iter = appenders.begin();  
iter != appender.end(); iter++) {

The Pool constructor calls apr_pool_create() and the destructor calls  

View raw message