Re: [Log4cplus-devel] [Question]: About Function 'initialize' in every log4cplus example code
Logging Framework for C++
Brought to you by:
wilx
From: Václav Z. <vha...@gm...> - 2013-10-23 10:19:59
|
On 23 October 2013 10:13, Zhen Ren wrote: > Hi all, > I am learning to use log4cplus example code. > > Notice that every example starts with Func 'initialize', And I want to know > what it do > for us, why it apears with form of Funtion instead of Class method. I looked > for it in API Doc, but cannot get any information. > > Anyone know it?please give me some help. The log4cplus::initialize() function is there to initialize the whole log4cplus library. In most usual cases, on both Windows and Unix--like platforms, it will be called for you. Unfortunately, there are cases when it will not be called automatically. This can happen if you are using static library log4cplus and static C and C++ run time libraries. It is safe to call the function multiple times before you use anything else from log4cplus. It is not safe to call the function from different threads, there is no locking. The assumption is that, at the worst case, you will call the function at the top of main(). -- VZ |