You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "sebastian (JIRA)" <ji...@apache.org> on 2005/11/07 13:53:21 UTC

[jira] Created: (VELOCITY-417) add log attribute to ant task and "stringUtils" to context

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




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: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


[jira] Resolved: (VELOCITY-417) add log attribute to ant task and "stringUtils" to context

Posted by "Will Glass-Husain (JIRA)" <ji...@apache.org>.
     [ 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: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


[jira] Closed: (VELOCITY-417) add log attribute to ant task and "stringUtils" to context

Posted by "Henning Schmiedehausen (JIRA)" <de...@velocity.apache.org>.
     [ https://issues.apache.org/jira/browse/VELOCITY-417?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henning Schmiedehausen closed VELOCITY-417.
-------------------------------------------


> add log attribute to ant task and "stringUtils" to context
> ----------------------------------------------------------
>
>                 Key: VELOCITY-417
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-417
>             Project: Velocity
>          Issue 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.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org