|
From: David H. L. Jr. <dh...@dl...> - 2003-07-12 23:25:05
|
I am new to log4cpp and relatively new to C++. But the capabilities
of log4cpp look very useful as aides to the software I develop.
However I have been unable to figure out how to get log4cpp to work
as I need.
Atleast for me logging is a global function for the whole
application. Therefore I need a global logger/category beyond the scope
of of a single function.
I have been unable to declare a category object outside the confines
of a function. Either there is not an appropriate constructor or the
resulting program faults during initialization with a bad memory access.
I can declare a global pointer to a category object, and assign it a
value inside main, but some of the methods generate exceptions that do
not appear to be documented when used in the pointer form cat->method()
instead of cat.method();
The problem here is more likely to lie with my early c++ skills rather
than log4cpp but a clue would be appreciated.
I have done numerous searches looking for documentation or sample
applications that use log4cpp and there is a dearth of documentation
available. I tend to find I learn more easily for examples, but the
examples I have found are primarily the test samples that come with
log4cpp, which are nice but either confine a category to the scope of a
function or pass it as an argument neither of which are practical and
violate the precept that the debugging is independent of the operation
of the program being debugged.
|