Or -- why not have an "Initialize()" method in ONE of the DLL's.... then 
all of the others can call Initialize(), which should only init the 
Log4CXX once?

Renny Koshy
President & CEO

--------------------------------------------
Rubix Information Technologies, Inc.
www.rubixinfotech.com



Lijuan Zhu <zhu.lij...@gmail.com> 
04/21/2009 10:25 PM
Please respond to
"Log4CXX User" <log4cxx-user@logging.apache.org>


To
Log4CXX User <log4cxx-user@logging.apache.org>
cc

Subject
Re: How can I know log4cxx is initialized?






Your project should have an entry point, like some Initialize method, if 
you initalize the log4cxx there, the log4cxx should be initialized for all 
other dlls.

HTH,
Lijuan

On Wed, Apr 22, 2009 at 10:18 AM, yaohua xiao <bentry...@gmail.com> wrote:
Renny, Thanks for your replay!

I already have a singleton class called "log4cxx_LogManager" to manage 
log4cxx 
in all the dlls.

But I found that every dll will have a copy of that singleton class,
so the singleton manager "log4cxx_LogManager" is not single in the mutiple 
dll enviromnents.If let the log4cxx_LogManager do the log4cxx initialized 
stuff, 
will initialize more than one times.

Because log4cxx is compiled into a dll, it has only one copy in runtime.
So I want my log4cxx_LogManager query if log4cxx is initialzed first, if 
not, initialize it. 
otherwise, use the logger directly.

If log4cxx.dll has some initialize flag or api, the problem will simply 
solve.

2009/4/22 <renny.ko...@rubixinfotech.com>

Why don't you simply create a singleton instance of a class that will 
"manage" log4cxx for you? 

Then you can just query the singleton to see if it is initialized or 
not... or even just call the "init()" method of the singleton in all your 
DLL's... so the init will only happen once. 

Renny Koshy
President & CEO

--------------------------------------------
Rubix Information Technologies, Inc.
www.rubixinfotech.com 


Hi all,

I am new to log4cxx and have a mutiple dll project to use log4cxx for some 
logging task.
My project has 3 dll modules: a.dll, b.dll, c.dll , all dlls need logging.

log4cxx needs some initialize code such like 
BasicConfigurator::configure() 
, load properties files, to prepare the logger. Because i use import lib 
to load the dlls, 
i don't know which dll will load first. 

So I want to determine if log4cxx is initialized when I call log4cxx in 
each dll.
Is there any api can tell user is log4cxx initialized?

Thanks. 


Reply via email to