I am going through code for our app and trying to test our logging,
which uses Log4perl naturally, and am setting up a TestBuffer similar to
the way the internal Log4perl testing works (is this the best way to
test our logging?) and I am trying to figure out the difference between
the last two tests in,
http://search.cpan.org/src/MSCHILLI/Log-Log4perl-0.41/t/009Deuce.t
Listed here:
######################################################################
# Test the root logger via inheritance (discovered by Kevin Goess)
######################################################################
Log::Log4perl->reset();
Log::Log4perl::Appender::TestBuffer->reset();
Log::Log4perl->init("$EG_DIR/log4j-manual-3.conf");
$logger = Log::Log4perl->get_logger("foo");
$logger->debug("Gurgel");
ok(Log::Log4perl::Appender::TestBuffer->by_name("R")->buffer(),
'm#^\S+\s+N/A \'foo\' - Gurgel\n#');
ok(Log::Log4perl::Appender::TestBuffer->by_name("R")->buffer(),
'm#^\S+\s+N/A \'foo\' - Gurgel\n$#');
Is the 2nd test above supposed to only differ by the '$'?? Or is the
second "R" supposed to be a "stdout" like in the two tests previous to
it? In the former case what is this testing as I can't tell the
difference between the two?
I am fairly new to the whole Perl Q/A world, Test:: etc. and by no means
a Log4perl expert, so this threw me. Any ideas for testing the log
messages generated by our app is greatly appreciated, though I think I
have the TestBuffer appender working correctly...
Thanks,
http://danconia.org
|