You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Bill Burton <bi...@progress.com> on 2002/02/15 05:26:33 UTC

[PATCH] DVSL: Improved logging integration with Ant

Hello,

Wrote a Velocity to Ant Task logging adapter as a Velocity LogSystem
implementation described in the my proposal message
(http://marc.theaimsgroup.com/?l=velocity-dev&m=101365562627409&w=2)
except for in the first section where a default log file name is
mentioned.  

Now when using the <dvsl> task, all Velocity messages will be by default
routed to the corresponding Ant logging level and no longer written to a
file.  They are now displayed whereever Ant's logging has been directed
(if it has been redirected) and are subject to any Ant logger specified
with the -logger option.

In addition, running Ant with different logging levels will display an
appropriate level of Velocity messages.

    ant -quiet         --> display error messages
    ant                --> display errors and warnings
        In this default case, you don't see all the noise messages.
    ant -verbose       --> display errors, warnings and informationals
        If you want to see the noise messages, use this level.
    ant -debug         --> display all of the above plus debug messages

To provide more flexibility and a level of backward compatibility, a new
logfile attribute can be specified to the <dvsl> task.  This provides
logging in a manner compatible with the previous behavior but in a more
friendly way as the filename can easily be specified.  For instance,
    <dvsl logfile="${basedir}/docs.log" ... />

In addition, when Ant is run with either the -verbose or -debug options,
it will also output the processing time it took on the file:
    Processed foo.xml in 185 ms.
This restores functionality available in the original version of the DVSL
Task (although in a slightly different manner).

Changes:
File: DVSL.java
* Added a setLogFile method.
* Added a setLogSystem method which takes a class instance that implements
the LogSystem interface.
* Modified the setVelocityConfig method to merge any existing Velocity
properties into the passed Map.
* Cleaned up imports sorting and removing unnecessary ones.
* Javadoc cleanup.

File: DVSLTask.java
* Added a setLogFile method.
* Modified the execute method to set the log filename if specified,
otherwise instantiate the AntLogSystem class passing it to the DVSL
instance.
* Javadoc cleanup; removed extranious comments

File: xdocs/ant_task_reference.xml
* Updated to describe new logging behavior.
* Added missing description of outputencoding attribute.

Additions:
File: AntLogSystem.java
* Implements the Velocity LogSystem interface directing messages to a
specified Ant Task instance.

Right now the AntLogSystem class is in the .dvsl package.  Is that okay or
should I create a new package for it?

-Bill

Re: [PATCH] DVSL: Improved logging integration with Ant

Posted by Bill Burton <bi...@progress.com>.
Hello,

Seems I forgot that cvs diff doesn't catch new files.  Attached is
AntLogSystem.java.

-Bill

Bill Burton wrote:
> 
> Hello,
> 
> Wrote a Velocity to Ant Task logging adapter as a Velocity LogSystem
> implementation described in the my proposal message
> (http://marc.theaimsgroup.com/?l=velocity-dev&m=101365562627409&w=2)
> except for in the first section where a default log file name is
> mentioned.
> 
> Now when using the <dvsl> task, all Velocity messages will be by default
> routed to the corresponding Ant logging level and no longer written to a
> file.  They are now displayed whereever Ant's logging has been directed
> (if it has been redirected) and are subject to any Ant logger specified
> with the -logger option.
> 
> In addition, running Ant with different logging levels will display an
> appropriate level of Velocity messages.
> 
>     ant -quiet         --> display error messages
>     ant                --> display errors and warnings
>         In this default case, you don't see all the noise messages.
>     ant -verbose       --> display errors, warnings and informationals
>         If you want to see the noise messages, use this level.
>     ant -debug         --> display all of the above plus debug messages
> 
> To provide more flexibility and a level of backward compatibility, a new
> logfile attribute can be specified to the <dvsl> task.  This provides
> logging in a manner compatible with the previous behavior but in a more
> friendly way as the filename can easily be specified.  For instance,
>     <dvsl logfile="${basedir}/docs.log" ... />
> 
> In addition, when Ant is run with either the -verbose or -debug options,
> it will also output the processing time it took on the file:
>     Processed foo.xml in 185 ms.
> This restores functionality available in the original version of the DVSL
> Task (although in a slightly different manner).
> 
> Changes:
> File: DVSL.java
> * Added a setLogFile method.
> * Added a setLogSystem method which takes a class instance that implements
> the LogSystem interface.
> * Modified the setVelocityConfig method to merge any existing Velocity
> properties into the passed Map.
> * Cleaned up imports sorting and removing unnecessary ones.
> * Javadoc cleanup.
> 
> File: DVSLTask.java
> * Added a setLogFile method.
> * Modified the execute method to set the log filename if specified,
> otherwise instantiate the AntLogSystem class passing it to the DVSL
> instance.
> * Javadoc cleanup; removed extranious comments
> 
> File: xdocs/ant_task_reference.xml
> * Updated to describe new logging behavior.
> * Added missing description of outputencoding attribute.
> 
> Additions:
> File: AntLogSystem.java
> * Implements the Velocity LogSystem interface directing messages to a
> specified Ant Task instance.
> 
> Right now the AntLogSystem class is in the .dvsl package.  Is that okay or
> should I create a new package for it?
> 
> -Bill

Re: [PATCH] DVSL: Improved logging integration with Ant

Posted by Bill Burton <bi...@progress.com>.
Thanks Geir!

"Geir Magnusson Jr." wrote:
> 
> This stuff is great.  All in!
> 
> On 2/14/02 11:26 PM, "Bill Burton" <bi...@progress.com> wrote:
> 
> > Hello,
> >
> > Wrote a Velocity to Ant Task logging adapter as a Velocity LogSystem
> > implementation described in the my proposal message
> > (http://marc.theaimsgroup.com/?l=velocity-dev&m=101365562627409&w=2)
> > except for in the first section where a default log file name is
> > mentioned.
> 
> [SNIP]
> 
> --
> Geir Magnusson Jr.                                     geirm@optonline.net
> System and Software Consulting
> My inner cowboy needs to yodel.
>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [PATCH] DVSL: Improved logging integration with Ant

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
This stuff is great.  All in!


On 2/14/02 11:26 PM, "Bill Burton" <bi...@progress.com> wrote:

> Hello,
> 
> Wrote a Velocity to Ant Task logging adapter as a Velocity LogSystem
> implementation described in the my proposal message
> (http://marc.theaimsgroup.com/?l=velocity-dev&m=101365562627409&w=2)
> except for in the first section where a default log file name is
> mentioned.  

[SNIP]

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
My inner cowboy needs to yodel.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>