Well, that's good news, Mike, but what about the following did I not
understand?  When you said "isn't stored usually", I guess you meant
that, if there a file is used, it is.

This would be nice to have in the docs.

Thanks.

-Eric.

> -----Original Message-----
> From: Mike Schilli =5Bmailto:m=40perlmeister.com=5D
> Sent: Thursday, June 28, 2007 7:54 PM
> To: Berg, Eric
> Cc: log4perl-devel=40lists.sourceforge.net
> Subject: Re: =5Blog4perl-devel=5D When a missing config file
>
> On Thu, 28 Jun 2007, Berg, Eric wrote:
>
> > I've been looking for a way to get l4p to tell me where the
config=20
> > under which it's running comes from. Essentially, I'd like to
have=20
> > a method that would return the full path to the config file that=20
> > it's currently using.
> >
> > Obviously, there are complications, such as those relating to=20
> > programatic configuration subsequent to loading configs from a file,

> > in-line, and config (ini) files, but I could find nowhere that
the=20
> > file name passed in to init() is retrievable.
>
> The name of the file isn't stored usually, since you can not only
use=20
> a file but a string, a hashref, an URL, etc. to initialize L4p.
>
> Since you're calling init() in the first place, wouldn't it be
easier=20
> to store the filename in your application instead?
>
> -- Mike 

-----Original Message-----
From: Mike Schilli [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 27, 2007 3:29 AM
To: Berg, Eric
Cc: [EMAIL PROTECTED]; log4perl-devel@lists.sourceforge.net
Subject: Re: [log4perl-devel] Logger Properties

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 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

Reply via email to