[ http://issues.apache.org/jira/browse/VELOCITY-417?page=all ]
     
Will Glass-Husain resolved VELOCITY-417:
----------------------------------------

    Fix Version: 1.5
     Resolution: Fixed

Thanks for the patch.  

I committed the first patch (logfile).  The second patch (StringUtils) I left 
out.  The recommended way to add new items to the context is to subclass 
TexenTask then override populateInitialContext.  Since StringUtils is not used 
in this manner anywhere else I thought it best to leave this to the individual 
developer.

I'm going to close the issue for the moment - if you want to discuss this last 
point further let's do it on the velocity-dev list.  Thanks again!

> add log attribute to ant task and "stringUtils" to context
> ----------------------------------------------------------
>
>          Key: VELOCITY-417
>          URL: http://issues.apache.org/jira/browse/VELOCITY-417
>      Project: Velocity
>         Type: Improvement
>   Components: Texen
>     Reporter: sebastian
>      Fix For: 1.5

>
> logging.patch: adds a "logFile" attribute 
> --- src/java/org/apache/velocity/texen/ant/TexenTask.java.orig        Thu Oct 
> 20 15:12:22 2005
> +++ src/java/org/apache/velocity/texen/ant/TexenTask.java     Thu Oct 20 
> 15:55:07 2005
> @@ -21,6 +21,7 @@
>  import java.util.Hashtable;
>  import java.util.Iterator;
>  import java.util.Map;
> +import java.util.Properties;
>  
>  import java.io.File;
>  import java.io.Writer;
> @@ -136,6 +137,12 @@
>      protected boolean useClasspath;
>  
>      /**
> +     * The LogFile (incl. path) to log to.
> +     */
> +    protected String logFile;
> +
> +
> +    /**
>       * Path separator.
>       */
>      private String fileSeparator = System.getProperty("file.separator");
> @@ -253,6 +260,22 @@
>      }        
>  
>      /**
> +     * Sets the log file.
> +     */
> +    public void setLogFile(String log)
> +    {
> +        this.logFile = log;
> +    }
> +
> +    /**
> +     * Gets the log file.
> +     */
> +    public String getLogFile()
> +    {
> +        return this.logFile;
> +    }
> +
> +    /**
>       * Set the context properties that will be
>       * fed into the initial context be the
>       * generating process starts.
> @@ -413,6 +436,11 @@
>                  ve.setProperty(
>                      "classpath." + VelocityEngine.RESOURCE_LOADER + 
>                          ".modificationCheckInterval", "2");
> +            }
> +            
> +            if (this.logFile != null) 
> +            {
> +                ve.setProperty(ve.RUNTIME_LOG, this.logFile);
>              }
>              
>              ve.init();
> stringUtils.patch: adds a stringutils obj to the context
> --- src/java/org/apache/velocity/texen/ant/TexenTask.java.orig        Wed Apr 
> 14 14:26:42 2004
> +++ src/java/org/apache/velocity/texen/ant/TexenTask.java     Thu Oct 20 
> 15:09:03 2005
> @@ -568,6 +568,7 @@
>          throws Exception
>      {
>          context.put("now", new Date().toString());
> +        context.put("stringUtils", new StringUtils());
>      }
>  
>      /**

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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

Reply via email to