On Nov 2, 2007, at 9:49 AM, Anita Banerji wrote:
I am also finding a significant performance penalty when including
DEBUG level statements even though this level is not enabled, and
therefore have to comment out log4cxx code out of frequently run
areas.
Any ideas on how I can fix this?
Thanks.
If you are using logstream, I believe it had a pretty high overhead
on some platforms as the base std::basic_ostream<> constructor was
surprisingly expensive. However, if you attempted to base logstream
on something other than std::basic_ostream, then you could not match
all of the basic_ostream semantics. Likely logstream will be pulled
from the distribution before release since it was hard to get just
right. It is only just one header file and if you want to keep using
it, you would be free to continue.
Recently, the LOG4CXX_INFO and similar macros were reworked to
restore use of insertion operators within the message parameter to
the macro like:
LOG4CXX_INFO(logger, "Hello" << ", World");
The current implementation doesn't compile with VC6 (no problem with
VC 2008 or gcc, haven't checked VC 7, 7.1 or 8) due to a compiler bug/
limitation.
If you are using logstream (and not using VC6), I'd suggest modifying
the code to use the LOG4CXX_INFO macros and testing the performance.
If you are using the LOG4CXX_INFO macros and are still seeing
performance issues, please create a sample program and attach it to a
bug report and I'll profile it and see if there is something biting us.