log4cxx in apt?
Hi all,
I'd like to propose that we start using log4cxx in apt, replacing
(eventually) the various semi-documented Debug:: configuration items
that are currently used to enable debugging traces.
I've started using it for debugging in the aptitude development
branch, and I've found it to be a huge improvement (not unsurprisingly,
given my past experiences with other frameworks like this). The
logging macros make it easy to add logging statements anywhere you
might want to, and the performance cost is relatively low too. One of
the big problems with developing and debugging apt has traditionally
been that it's very opaque; aggressively writing trace statements will
help to combat that.
If log4cxx is used, I'd suggest that we adopt a policy similar to
what I've done in aptitude, where loggers are only retrieved by
invoking a "getFooLogger()" method that's in a central .h file. The
advantage is that you can get an at-a-glance picture of which logging
categories are being used in the project, which should make it easier
to keep documentation up to date.
I would also suggest that we start implementing operator<<() for
some of the major apt structures (in particular, for cache iterators),
for use in logging statements; again, this is about driving down the
programmer-cost of logging so that we get more logging statements
where they're needed.
Comments?
Daniel
Reply to: