From: Kevin G. <ke...@go...> - 2004-01-09 16:27:33
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Tony Bowden wrote: | With some fiddling around it seems that the problem is that my | Log4perl::init() in the test gets clobbered by the one in the code that | I'm testing and so doesn't actually log to the TestBuffer at all. No doubt. When you initialize Log4perl it's initialized for the entire perl interpreter. With that in mind you don't need to call init() inside your new() method, just put it in the body of the module so that it loads once. Then make sure the test's init() method gets called after the module's init method, like it does in your code sample. See the patch below. Mike, please correct me if my understanding of easy_init() is wrong. - --- test.old.pl Fri Jan 9 08:23:35 2004 +++ test.pl Fri Jan 9 08:18:24 2004 @@ -2,9 +2,10 @@ ~ use Log::Log4perl ':easy'; +Log::Log4perl->easy_init($INFO); ~ sub new { - -Log::Log4perl->easy_init($INFO); + ~ bless {} => shift ~ } - -- Happy Trails . . . Kevin M. Goess -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) Comment: Using GnuPG with Netscape - http://enigmail.mozdev.org iD8DBQE//tZY4g4/Tl71vUkRAqfpAKDOZ001BOHxXTYrzJAgOV2LFaoO+gCfVpHH DEe4yOSCk2NLEWcafv5lxPw= =Ockr -----END PGP SIGNATURE----- |