|
From: Bastiaan B. <Bas...@li...> - 2003-04-07 15:34:14
|
On Thu, 2003-04-03 at 16:14, O'Rourke, Frank wrote: > I am using the log4cpp-0.3.4b version of log4cpp. > > I have 2 components in a product which each use log4cpp and try to > initialise it. > > Is there a way of detecting whether log4cpp has already being configured. I > tried using > log4cpp::Category& root = log4cpp::Category::getRoot(); > log4cpp::AppenderSet appenders = root.getAllAppenders(); > int size = appenders.size(); > > then test (size > 1) for already initialised > > The problem is that getAllAppenders does not work on MSVC as reported and > fixed by patch. Is there any alternative way of telling if log4cpp is > already configured. No, currently there isn't a way to check this. That's because log4cpp doesn't require an application to explicitly 'initialize' log4cpp: all Objects and methods should work upon first use of log4cpp. Of course your logging may not end up where you want it too.... Since the configuration of your logging is not an issue for a single component but for your whole application, I'd suggest you move the configuration calls, both PropertyConfigurator::configure() or manual Category::addAppender(), out of the components into the initialization part of your application. The componentents may are allowed to call Category::debug(), etc. before you've done the configuration. Good luck, Bastiaan > > Thanks > Frank > > > ------------------------------------------------------- > This SF.net email is sponsored by: ValueWeb: > Dedicated Hosting for just $79/mo with 500 GB of bandwidth! > No other company gives more support or power for your dedicated server > http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ > _______________________________________________ > Log4cpp-devel mailing list > Log...@li... > https://lists.sourceforge.net/lists/listinfo/log4cpp-devel |