From: Jim C. <jc...@di...> - 2003-10-23 05:39:52
|
hi folks, pls accept this patch to make pre 0.38 init available as initAdd. I need it to restore the ability of Log::Log4perl::AutoCategorize to play nice with others. Specifically, tests: 09_todo_coexist (not really todo anymore), and 10_multi_pack.t verify its ability to be used in part of a project, and to interoperate with other parts which are using the standard Log::Log4perl. If they make it in 0.39, Ill follow with an 0.03 Also: * I changed Changes to reflect that not only easy_init, but all its friends, do the reset. * I didnt document initAdd, cuz no mention was made of reset in main pod, so theres no good context to explain the difference. * initAdd creates one more way to alter a config at runtime. I dont think its a good way to do so repeatedly. In particular, I think mixing it and init-and-watch() would be a bad idea, unless youre *careful* to re-add config changes you made dynamically. * you may prefer expose only Log::Log4perl::Config::initAdd, not in main class, but that felt a bit too secret. FMITYWTK: # note the use time init, if you want it. use Log::Log4perl::AutoCategorize ( alias => 'myLogger', initfile => 'log-conf', # no effect here, cuz reset inside easy_init ); use Log::Log4perl qw(:easy); Log::Log4perl->easy_init ({ level => $INFO, file => "out.09_todo_coexist_easy", layout => 'F=%F{1} M=%M L=%L: Cat=%c %m%n', }); # in Log::Log4perl-0.38, easy_init now resets config, so we re-add it here Log::Log4perl->initAdd ('log-conf'); # these also work #Log::Log4perl::Config->initAdd ('log-conf'); #Log::Log4perl::AutoCategorize->initAdd ('log-conf'); |