logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curt Arnold <carn...@apache.org>
Subject Re: Upgrading from 0.9.7 to 0.10.0 - Pool Information
Date Tue, 05 Aug 2008 06:00:40 GMT

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;
    appender->activateOptions(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++) {
	(*iter)->activateOptions(p);
    }

The Pool constructor calls apr_pool_create() and the destructor calls  
apr_pool_destroy.



Mime
View raw message