On Wed, 26 Sep 2007, Berg, Eric wrote:

> The answer was that that information isn't kept.  For one thing, it
> could be that the configuration was derived or modified
> programatically.

That's not accurate. Of course it's kept, otherwise the file
appender wouldn't know what the name of the file is, right? :)

To find the name of the file the file appender is using, first obtain
a reference to the file appender. If you have a configuration like

    log4perl.category.Bar.Twix         = WARN, Logfile
    log4perl.appender.Logfile          = Log::Log4perl::Appender::File
    log4perl.appender.Logfile.filename = test.log
    ...

then find the "Logfile" appender via

    my $app = Log::Log4perl->appender_by_name("Logfile");

and to obtain the name of the logfile it's using, call its 'filename'
method:

    print $app->filename(), "\n";

-- Mike

Mike Schilli
[EMAIL PROTECTED]

>
> Nonethless, I think that there are times when it would be very helpful
> to have a path/filename for the config file.  One of these days, if I
> get some time........
>
> Eric.
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> [EMAIL PROTECTED]
> Sent: Wednesday, September 26, 2007 5:21 AM
> To: log4perl-devel@lists.sourceforge.net
> Subject: [log4perl-devel] Logger Properties
>
> Hi,
>
> know somebody how can I get the properties of a logger i.e. name of used
> logfile? In log4perl manual I don't fint any hint.
>
> Example:
>
> $logger = Log::Log4perl->get_logger('loggername');
>
> I miss something like:
>
> %properties = $logger->get_logger_properties(); $current_logfile =
> $properties{filename};
>
> Thanks Gerd
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
> - - - - -
>
> This message is intended only for the personal and confidential use of the 
> designated recipient(s) named above.  If you are not the intended recipient 
> of this message you are hereby notified that any review, dissemination, 
> distribution or copying of this message is strictly prohibited.  This 
> communication is for information purposes only and should not be regarded as 
> an offer to sell or as a solicitation of an offer to buy any financial 
> product, an official confirmation of any transaction, or as an official 
> statement of Lehman Brothers.  Email transmission cannot be guaranteed to be 
> secure or error-free.  Therefore, we do not represent that this information 
> is complete or accurate and it should not be relied upon as such.  All 
> information is subject to change without notice.
>
> --------
> IRS Circular 230 Disclosure:
> Please be advised that any discussion of U.S. tax matters contained within 
> this communication (including any attachments) is not intended or written to 
> be used and cannot be used for the purpose of (i) avoiding U.S. tax related 
> penalties or (ii) promoting, marketing or recommending to another party any 
> transaction or matter addressed herein.
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> log4perl-devel mailing list
> log4perl-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/log4perl-devel
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
log4perl-devel mailing list
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to