My favorite writeup on logging is from the soon-to-be-released book
"Growing Object-Oriented Software, Guided by Tests" by Steve Freeman
and Nat Pryce, the authors of the JMock tool. They've published an
early draft online so you can read it now:
http://www.mockobjects.com/book/listening-to-the-tests.html
See the section "Logging is a Feature"
The short answer is that most logging tends to be an afterthought
rather than treated with the same care as the other business-requested
features. This typically means a proliferation of log statements
scattered throughout the code. If the logs we're talking about are
used by the operations group for critical support, then it's important
that those messages get unit tested. The most common use of Log4j
sprinkles static method calls to Logger.getLogger() throughout several
classes and is hard to test. Instead, Freeman and Pryce recommend
treating logging as a service which gets injected into classes that
need it, and unit tested that way.
Structuring the logging in this way will make it much easier to write unit or acceptance tests.
Dan