From: Matthew B. <mat...@co...> - 2005-07-20 11:20:27
|
Alistair Young wrote: > log4j gurus - is there any way to get a RollingFileAppender to be > servlet aware? What I mean is: > > <appender name="AuthenticatorRolling" > class="org.apache.log4j.RollingFileAppender"> > <param name="File" value="/WWW/bod/WEB-INF/logs/bod.log"/> > <param name="MaxFileSize" value="100KB"/> > <param name="MaxBackupIndex" value="2"/> > <layout class="org.apache.log4j.PatternLayout"> > <param name="ConversionPattern" value="%m%n"/> > </layout> > </appender> > > <param name="File" value="/WWW/bod/WEB-INF/logs/bod.log"/> > > is there any way to do a getRealPath sort of thing to get: > > <param name="File" value="/WEB-INF/logs/bod.log"/> > > i.e. remove the machine dependant part of the path? In short not really. If you create this logger from programmatically (from Java) then yes. Have a look at my ServletAppender on Bodington HEAD that I setup from the context listener. Logging to a directory inside the webapp isn't a "good thing" as in some situations you may not be able to write there. Also when an upgrade is done you will lose your logs so beware. -- +--Matthew Buckett-----------------------------------------+ | VLE Developer, Learning Technologies Group | | Tel: +44 (0) 1865 283660 http://www.oucs.ox.ac.uk/ | +------------Computing Services, University of Oxford------+ |