velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Townson, Chris" <C.Town...@nature.com>
Subject RE: exception handling and logging from velocity tools best practice
Date Wed, 21 Jun 2006 16:17:19 GMT
Thanks Nathan (+ Frank)

What you say makes sense.

> 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
> 

I take your point here entirely ... with logging errors coming under the category of "handling"
them, I reckon

> 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.
> 

The whole logging thing was on my mind because of differences between my own development environment
and that on our servers ... in this case, a slight difference in the way logging is done.

What I was thinking was: "I should be able to create a tool which logs errors to the velocity
log as its exception handling in a way that doesn't make it dependent upon any specific implementation"

That "known difference" (between my machine and our servers) was easily overcome ... I was
thinking the whole transparency thang was more important for making it easy to reuse tools
elsewhere/distribute without having to hack their error handling.

... at the moment, I'm using a Constants class that defines a static Constants.LOG. However,
using that in a tool seems a little wrong to me ... mainly because it depends on an import
that is only _ever_ going to be present on either my laptop or our servers! :D

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