dlr         02/02/04 09:19:26

  Modified:    src/java/org/apache/turbine Turbine.java
  Log:
  Used new constant LOGGING_ROOT (from TurbineConstants interface) to
  allow override of the default logging directory of "/logs" (relative
  to web app root) to the value specified in the Turbine servlet's
  initialization parameters.
  
  Revision  Changes    Path
  1.25      +13 -6     jakarta-turbine-3/src/java/org/apache/turbine/Turbine.java
  
  Index: Turbine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/Turbine.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -u -r1.24 -r1.25
  --- Turbine.java      24 Jan 2002 03:55:26 -0000      1.24
  +++ Turbine.java      4 Feb 2002 17:19:26 -0000       1.25
  @@ -121,7 +121,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Rafal Krzewski</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Daniel Rall</a>
  - * @version $Id: Turbine.java,v 1.24 2002/01/24 03:55:26 jvanzyl Exp $
  + * @version $Id: Turbine.java,v 1.25 2002/02/04 17:19:26 dlr Exp $
    */
   public class Turbine
       extends HttpServlet
  @@ -567,7 +567,7 @@
           // runtime. Right now this creates the directories
           // for logging but we might have more of these
           // directories in the future.
  -        createRuntimeDirectories();
  +        createRuntimeDirectories(config.getInitParameter(LOGGING_ROOT));
           
           // Get the full path to the properties file.
           if (propsFile == null)
  @@ -704,14 +704,21 @@
        *
        * i) directories for logging
        *
  +     * @param path The directory to write log files to (relative to
  +     * the web application root), or <code>null</code> for the default
  +     * of <code>/logs</code>.
        */
  -    private static void createRuntimeDirectories()
  +    private static void createRuntimeDirectories(String path)
       {
  -        // Create the logging directory
  -        File logDir = new File(getRealPath("/logs"));
  -        
  +        if (StringUtils.isEmpty(path))
  +        {
  +            path = "/logs";
  +        }
  +
  +        File logDir = new File(getRealPath(path));
           if (!logDir.exists())
           {
  +            // Create the logging directory
               if (!logDir.mkdirs())
               {
                   System.err.println("Cannot create directory for logs!");
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to