in reply to Log4Perl not changing to new log
If you don't like this answer, then the easiest thing to do is intercept all calls that initialize a logger and keep track of loggers automatically. When you need to reinitialize, you will then have that list and can walk it in an automated fashion. There are several ways to do this, but the one that I recommend is to rename your current Log4PerlInit methods to _Log4PerlInit and then somewhere high in your inheritance tree write the following (untested):
And now you have a hash whose keys are all loggers that you have. Walk the keys of the hash and reset them.sub Log4PerlInit { my ($self, @args) = @_; # Is this is an instance or class method? I don't # know what you are doing, so I will support both. $used_loggers{ref($self) || $self} = 1; $self->Log4PerlInit(@args); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Log4Perl
by set_uk (Pilgrim) on Oct 29, 2003 at 19:17 UTC |