logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sk k <skk7...@yahoo.com>
Subject Re: get filename
Date Fri, 18 Oct 2002 16:56:13 GMT
Yes you can.

Get the reference to the FileAppender and call
getFile(). This should return the name of the file the
log msgs are being written to.

Sample code:
-----------
   Appender appender = logger.getAppender("XXXX");
   if (appender instanceof FileAppender) {
      FileAppender app = (FileAppender) appender;
      app.getFile();
   }

--- "Shaw, Chris" <Chris.Shaw@ecb.int> wrote:
> Hi,
> 
> Is it possible to get the name of the file being
> logged to?
> 
> I'm using JBoss so I don't configure Log4J within my
> application - the
> property in question is in log4j.xml property file
> and log4j is already
> configured by the time my code comes to use it.
> (AFAIK, it is not possible within JBoss to start
> your own instance of log4j
> since JBoss is already using one.... see
>
http://www.jboss.org/forums/thread.jsp?forum=63&thread=16993&message=3725722
> )
> 
> I was looking in the docs and API for some way if
> doing something like...
>   Properties props = category.getProperties();
> and then
>   props.getPropery("filename");
> (or equivalent).
> 
> ..but all I found was PropertyGetter and I couldn't
> for the life of me work
> out if this was the answer.
> 
> Thanks
> 
> Chris
> -=-=-=
> 
> Any e-mail message from the European Central Bank
> (ECB) is sent in good faith but shall neither be
> binding nor construed as constituting a commitment
> by the ECB except where provided for in a written
> agreement.
> This e-mail is intended only for the use of the
> recipient(s) named above. Any unauthorised
> disclosure, use or dissemination, either in whole or
> in part, is prohibited.
> If you have received this e-mail in error, please
> notify the sender immediately via e-mail and delete
> this e-mail from your system.
> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:log4j-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:log4j-user-help@jakarta.apache.org>
> 


__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com

--
To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>


Mime
View raw message