velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Bubna" <nbu...@gmail.com>
Subject Re: exception handling and logging from velocity tools best practice
Date Wed, 21 Jun 2006 15:35:39 GMT
Hi Chris,

The quick answer is that there aren't really any logging docs specific
to velocity tools, and i'm not sure how best to accomplish what you
describe with the pre-1.5 versions of Velocity and VelocityTools.  my
head just hasn't been in that space for a while now.  And since things
are likely to change a lot once we get Velocity 1.5 out the door,
there's no simple answer beyond that.  But, for now, here's the two
general guidelines i've tried to follow for logging and exception in
developing tools both for VelocityTools and my own projects:

1) tools should generally handle any exceptions caused by using them.
if your tool is causing exceptions it shouldn't/can't catch and
handle, then you probably shouldn't be doing that in a tool

2) when integrating with a separate controller (e.g. VelocityStruts
integrating w/Struts), then at least tools specific to that controller
should use the logging facilities that the controller is using.  thus
VelocityStruts uses commons-logging.

that's probably not the advice you're looking for, but i have little
advice beyond that at the moment.  oh, and i should mention that we do
also use commons-logging in VelocityView, but once Velocity 1.5 comes
out, i plan to convert VelocityView to use the Velocity logging
facilities.  the way Tomcat 5.5+ is using commons-logging has made it
much less palatable to me for web applications, with the improvements
i've added in the 1.5 branch, i believe Velocity's logging facilities
will be much easier and natural to work with going forward.

hope this helps a little at least. :)

On 6/20/06, Townson, Chris <C.Townson@nature.com> wrote:
> Hi,
>
> I was wondering if there were any docs anywhere on recommended ways to handle exceptions/logging
in velocity tools.
>
> I'm using VelocityViewServlet with a SimpleLog4JLogSystem and want a nice, abstracted
way for velocity tools (loaded via toolbox) to log errors to whatever velocity.log is specified
in velocity.properties (whether or not that's SimpleLog4JLogSystem or not).
>
> What's the best way to go about achieving that?
>
> Cheers,
>
> Chris
>
> ********************************************************************************
> DISCLAIMER: This e-mail is confidential and should not be used by anyone who is
> not the original intended recipient. If you have received this e-mail in error
> please inform the sender and delete it from your mailbox or any other storage
> mechanism. Neither Macmillan Publishers Limited nor any of its agents accept
> liability for any statements made which are clearly the sender's own and not
> expressly made on behalf of Macmillan Publishers Limited or one of its agents.
> Please note that neither Macmillan Publishers Limited nor any of its agents
> accept any responsibility for viruses that may be contained in this e-mail or
> its attachments and it is your responsibility to scan the e-mail and
> attachments (if any). No contracts may be concluded on behalf of Macmillan
> Publishers Limited or its agents by means of e-mail communication. Macmillan
> Publishers Limited Registered in England and Wales with registered number 785998
> Registered Office Brunel Road, Houndmills, Basingstoke RG21 6XS
> ********************************************************************************
>

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


Mime
View raw message