Regarding this patch, I meant to submit it for
review and approval; I have commit access and
can commit it if everybody agrees this is the
desired behaviour. Thanks,


-- 
Gonzalo A. Diethelm
[EMAIL PROTECTED]


> -----Original Message-----
> From: Diethelm Guallar, Gonzalo 
> Sent: Monday, December 18, 2000 1:49 PM
> To: 'Turbine'
> Subject: Patch for relative log file
> 
> 
> When specifying a relative path name for the log file,
> the code was trying to create it first without making
> reference to the ServletContext, and only if that failed
> it was trying to use ServletContext. In my config (WinNT,
> Resin), this meant that the log file was never created
> relative to the ServletContext. Here is a patch that
> reverses the order for this check. The patch is included
> as plain text and as an attachment, in case something
> funny happens to it...
> 
> 
> 
> Index: src/java/org/apache/turbine/util/Log.java
> ===================================================================
> RCS file: 
> /products/cvs/turbine/turbine/src/java/org/apache/turbine/util
> /Log.java,v
> retrieving revision 1.4
> diff -u -r1.4 Log.java
> --- src/java/org/apache/turbine/util/Log.java 2000/12/18 
> 00:58:25      1.4
> +++ src/java/org/apache/turbine/util/Log.java 2000/12/18 16:42:41
> @@ -144,21 +144,40 @@
>                  "document for instructions on how to do this.\n");
>              }
>  
> +            logfile = null;
>              if (logFileString != null)
>              {
> -                try
> +                if (logfile == null)
>                  {
> -                    logfile = new FileWriter( logFileString, true );
> -                }
> -                catch (FileNotFoundException fnfe)
> -                {
> +                    // Attempt to create the log file relative to the
> +                    // ServletContext root.
>                      ServletConfig sc = 
> Turbine.getLocalServletConfig();
>                      if (sc != null)
> +                    {
> +                        String lf = ServletUtils.expandRelative( sc, 
> +                                                             
>     logFileString );
> +                        try
> +                        {
> +                            logfile = new FileWriter( lf, true );
> +                        }
> +                        catch (FileNotFoundException fnfe)
> +                        {
> +                            logfile = null;
> +                        }
> +                    }
> +                }
> +
> +                if (logfile == null)
> +                {
> +                    // Attempt to create the log file just as
> +                    // indicated on the configuration file.
> +                    try
>                      {
> -                        // now attempt to create the log 
> file relative to the ServletContext root
> -                        logFileString = 
> ServletUtils.expandRelative( sc, 
> -                                            logFileString );
>                          logfile = new FileWriter( 
> logFileString, true );
> +                    }
> +                    catch (FileNotFoundException fnfe)
> +                    {
> +                        logfile = null;
>                      }
>                  }
>              }
> 
> 
> 
> 
> 
> 
> -- 
> Gonzalo A. Diethelm
> [EMAIL PROTECTED]
> 


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to