|
From: Mike S. <m...@pe...> - 2007-01-12 17:58:50
|
On Thu, 11 Jan 2007, Robert Jacobson wrote:
> I'm writing my own appender. How does one get the appender's own
> name, outside of the
> log() method? i.e, for this conf:
>
> log4perl.appender.Database = Log::Log4perl::Appender::DBI
>
> The appender's name is "Database".
Not sure if I understand correctly, but if you want to know how your
custom appender was used in the L4p configuration file, and specifically
what name has been assigned to it: That's ambiguous, because a certain
type of appender could be used multiple times under different names.
But you can always get all used appenders names by calling
my $appenders = Log::Log4perl->appenders();
which returns a reference to a hash mapping all appender names to their
appender objects. See the following man sections for details:
http://log4perl.sourceforge.net/d/Log-Log4perl/docs/html/Log/Log4perl.html#356d5
http://log4perl.sourceforge.net/d/Log/Log4perl/FAQ.html#92664
-- Mike
Mike Schilli
m...@pe...
|