On May 28, 2006, at 10:20 AM, Jeffrey Graham wrote:
Curt,
Thanks for the great info.
I thought that log4cxx would be further along than it is... I am
currently using
log4cpp with it's streams implementation and have been happy with
it; it is thread safe and does not suffer
from mangled buffer issues and thread problems like the streams
version in log4cxx. And the very
non-intuituve log-level weirdness.
There were previous discussions regarding stream-like interfaces
quite a long time ago (likely two years ago). I believe the log4cpp
used isolated streams (something like a std::ostrstream) for each
call. However, that would not be appropriate if you were trying to
port code that used std::cout extensively for "logging" and spent a
lot of effort setting up formatting, something like:
void converge() {
std::cout << std::scientific << std::width(12) << std::precision(5);
double err;
for(int i = 0; i < maxIterations; i++) {
err = ...;
std::cout << "Iteration " << i << ": error " << error <<
std::endl;
if (fabs(err) < tolerance) break;
}
}
In this case, the formatting set up code must be in effect at later
uses of the log stream or the original intent would not be honored.
We seemed to hit a stalemate where there were legitimate design goals
that appeared to be in conflict and we could not come up with one
implementation that satisfied all the concerns. The stream
implementation is layered on top of the core log4cxx, so there is
nothing that prevents users from creating their own implementation
that meets the concerns that are of interest to them. At this
point, the semantics of the log4cxx::logstream mimic the behavior of
a traditional STL stream, but the performance when disabled is not
acceptable. If we can't get the performance acceptable, we might
pull it from log4cxx before release and have it available in the
sandbox for experimentation or offer multiple implementations with
different trade-offs.
It appears that my C++ classes (with properly defined output
operators) also do NOT work with log4cxx.
What a pitty.... since I do a lot of that I'll have to stick with
my current log4cpp instead.
If you have something that works for you, great. If not, feel free
to ignore the logstream implementation and roll your own. Also,
check the logs and the JIRA and there may be other submissions more
to your likely. I know one (that was at least discussed) was similar
to log4cpp's.
I appreciate the help nontheless.
-Jeff