Check out the way I set things up for Barracuda, a Servlet Presentation Framework.
http://barracuda.enhydra.org/software/downloads/barracuda-1.1.0.zip docs are here http://barracuda.enhydra.org/cvs_source/Barracuda/index_details.html Basically, it uses a Log4jInit servlet which loads on startup. The Log4jInit servlet is located in a utility packaged called "plankton". It can be used outside the context of Barracuda itself. Check out Barracuda's web.xml for instructions on configuration. You can specify the path to the config file (normally this is relative to the context's own WEB-INF directory), a time frame for config reloading using configureAndWatch(), and, optionally, a the location of the log file you want (actually the path would be stored in a system variable generated by the servlet which stores this as its path....by default, a physical path to your context is dynamically generated which is ...yourContext/WEB-INF/logs). Note that you should probably not specify the path to the log file since it is automatically conveniently located within the WEB-INF/logs directory of your own webapp. The only times you would want to specify it is when either you *really* want it in another location or you are running your context directly from a .war file, in which case there would be no filesystem access to WEB-INF/logs. Barracuda uses a log4j.xml config file. In it, you can specify the dynamically generated system variable which contains the path to where your log4j logs will be kept. Then you can name them there. For example: <appender name="A2" class="org.apache.log4j.FileAppender"> <param name="File" value="${Barracuda.log.home}/main.log" /> <param name="Append" value="false" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%-4r [%t] %-5p %c %x - %m%n"/> </layout> </appender> Note the system variable reference to "${Barracuda.log.home}". The naming convention is [name of your context].log.home. This make sure that the system variable is unique since the name of your context must be unique. The context name is calculated automatically by the Log4jInit servlet. You can now name the log4j file anything you want. This method is extremely flexible and covers just about any case you can come up with for configuration. It supports both xml and properties files for configuration and falls back to BasicConfigurator if the path specified to the config file is invalid. <plug>Also, while you are at it, you might want to check out the rest of the Barracuda Presentation Framework. It is very powerful and a cleaner alternative to the JSP and competes with frameworks like Struts.</plug> later, Jake At 12:17 PM 7/11/2002 +0100, you wrote: >HI, > >I want to provide the log file name at initialising of a servlet as I want >to provide a relative path to the file. All the properties for logging are >set in the config file apart from the file name.when I provide the file name >at runtime the file gets created but nothing gets logged on as the >Propertycongigure pick only those property listed in the config file. >I tried using a system environment variable to indicate the path in the >config file but it creates the file default in c:\. >Could anyone pls suggest a solution how to give relative path to the log >file. > >Thanks, >Karishma > > > > > <mailto:[EMAIL PROTECTED]> Karishma Vinayak <?xml:namespace >prefix = o ns = "urn:schemas-microsoft-com:office:office" /> >Software Developer >UI Team > <http://www.hutchison3g.com/> Hutchison 3G UK Ltd > > > > > > > > > >________________________________________________________________________ > >This e-mail message (including any attachment) is intended only for the >personal >use of the recipient(s) named above. This message is confidential and may be >legally privileged. If you are not an intended recipient, you may not >review, copy or >distribute this message. If you have received this communication in error, >please notify >us immediately by e-mail and delete the original message. > >Any views or opinions expressed in this message are those of the author only. >Furthermore, this message (including any attachment) does not create any >legally >binding rights or obligations whatsoever, which may only be created by the >exchange >of hard copy documents signed by a duly authorised representative of >Hutchison >3G UK Limited. >________________________________________________________________________