You cannot get access to the file object itself for reading purpose because the 
FileAppender uses a FileWriter class for writing to the file. But you can learn 
the file name where the appender writes to.
Not each logger instance which you get by Logger.getLogger() has appenders 
attached. Only the logger instances whose name is exactly as a configured one 
have in fact the appenders attached as configured. So, if your logger instance 
has no RollingFileAppender attached, you would have to ask the parent logger, 
and so on, until you find the desired appender. 
Since the appenders instances are singleton, it would be easier to ask the 
LogManager for all appenders and iterate on these to find your desired 
RollingFileAppender. Once you have found the correct appender instance, you 
cast it and ask it for the file name for use in a file reader object.
I am not sure about the lock mechanisme applied by a RollingFileAppender, if 
there are any. You have to try.
Heri

-----Ursprüngliche Nachricht-----
Von: ja...@web.de [mailto:ja...@web.de] 
Gesendet: Montag, 4. Mai 2009 14:57
An: log4j-user@logging.apache.org
Betreff: Access logfile logger

Hi,

I'm using log4j with a DailyRollingFileAppender. Now I want to add some 
reporting functions to the same application that uses this appender. So I need 
to get access to the logfile that is written by the file appender. Only the 
current logfile needs to be read so is is possible via the logger instance?

Logger logger = Logger.getLogger(this.class);

Regards,
Jason


______________________________________________________
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to