You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Jeff Duska <Je...@noaa.gov> on 2002/06/26 23:12:29 UTC
Help Velocity Log file Question....
I'm having some trouble with one of the VelocityTools (more on that
problem in my next email), so I figure it was time to setup a Velocity
only log file. I'm having trouble doing this. I don't see what it wrong.
I copied the velocity.properties.fileloader file. I renamed it to
velocity.properties. I removed the following line, because I didn't need
it .
file.resource.loader.path = templates
I have the following in my web.xml file
<init-param>
<param-name>properties</param-name>
<param-value>/velocity.properties</param-value>
</init-param>
<init-param>
<param-name>toolbox</param-name>
<param-value>/WEB-INF/toolbox.xml</param-value>
</init-param>
The velocity.properties file is in my web application's root directory
like my velocity files.
What I've seen, so far :
1. Something really weird with the veclocity.properties would keep
returning to its previous name of velocity.properties.fileloader.
2. I copied the velocity.properties.fileloader to create the
veclocity.properties. This worked, but it took three reboots to delete
the file.
I'm assuming that Velocity does not use velocity.properties.fileloader
in any way shape or form. This is error is really weird and must be XP
related not Tomcat or Velocity related. Do you agree?
3. The log file is not being created and the Velocity log information is
still being added to the Tomcat logs.
What am I doing wrong?
Regards,
Jeff
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Velocity and Data Access Layer Questions...
Posted by Jeff Duska <Je...@noaa.gov>.
I'm using VelocityServlet project. My goal is to create a several
Velocity Library Tools that are implement the business objects.
I was using the model suggest by Martin Fowler called Row Data Gateway.
I tweaked this for the recommendation from Block in Effective Java to
use static factor instead of a constructor. In my case, I have
findbyRandomNumber(String rnd).
In my test code I just would have
PurchasedProduct pp=PurchasedProduct.findbyRandomNumber...
I wanted to have something like this for my template users
#set ($pp= PurchaseProduct.findyRandomNumber...)
$pp.isFree
The problem is that this doesn't work with VelocityServlet, because
there isn't a public construtor. I could change from a factory to a
method, since the object already exists. What happens when I want to
create another instance of the object?
I could refactor this into two classes. The business object and another
object that is the factory. My only concern is that I know have quite a
few classes.
Right now it does findbyRandomNumber
creates a ProductPurchaseFinder (does all the db stuff)
uses the ProductPruchaseFinder to create the ProductPurchaseGateway
ProductPurchase would then have function for the business rules
using a the private instance of ProductPurchaseGateway to stored the
data
I use the wrapper on ProductPurchase, because I like to replace my
database code with something like JDO, Torque or Castor at a later date.
At this point, I would need to create ProductPurchaseFactory to hold the
factory functionality. Does this make sense? I'm worried I've made this
too confusing. I really do expect to rip out the database code in future
release.
What are you suggestions?
Regards,
Jeff Duska
I
data acessand I have created a classes that Tools
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
VelocityViewServlet Project can you overide the Log File?Question
(Re: Help Velocity Log file Question....)
Posted by Jeff Duska <Je...@noaa.gov>.
I've been trying to figure why my velocity.properties is not being used.
I now see this is a "feature" of VelocityViewServlet. It says it set by
default to the Servlet API. I want to turn this off. I'm at loss at how
to get this to work.
I'm using the velocity.properties file right from the examples. It just
isn't working. Please help!
I'm digging into the source code, but I must I'm seeing why this isn't
working.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Help Velocity Log file Question....
Posted by Gabriel Sidler <si...@teamup.ch>.
Jeff Duska wrote:
>
> I'm having some trouble with one of the VelocityTools (more on that
> problem in my next email), so I figure it was time to setup a Velocity
> only log file. I'm having trouble doing this. I don't see what it wrong.
>
> I copied the velocity.properties.fileloader file. I renamed it to
> velocity.properties. I removed the following line, because I didn't need
> it .
>
> file.resource.loader.path = templates
>
> I have the following in my web.xml file
>
> <init-param>
> <param-name>properties</param-name>
> <param-value>/velocity.properties</param-value>
> </init-param>
> <init-param>
> <param-name>toolbox</param-name>
> <param-value>/WEB-INF/toolbox.xml</param-value>
> </init-param>
>
> The velocity.properties file is in my web application's root directory
> like my velocity files.
>
> What I've seen, so far :
>
> 1. Something really weird with the veclocity.properties would keep
> returning to its previous name of velocity.properties.fileloader.
>
> 2. I copied the velocity.properties.fileloader to create the
> veclocity.properties. This worked, but it took three reboots to delete
> the file.
>
> I'm assuming that Velocity does not use velocity.properties.fileloader
> in any way shape or form. This is error is really weird and must be XP
> related not Tomcat or Velocity related. Do you agree?
>
> 3. The log file is not being created and the Velocity log information is
> still being added to the Tomcat logs.
>
> What am I doing wrong?
Jeff,
If you are using VelocityViewServlet, the logger and the resource loader
cannot be configured in the velocity.properties files. They are currently
hard coded. Look at method initVelocity of
org.apache.velocity.tools.view.servlet.VelocityViewServlet for details.
I agree that this is not the best approach. Logger and resource loader should
only be set to defaults if the user does not configure anything else. Geir
mentioned in the past that he wants to look into this.
For now if you want to change logging or resource loading you have to code.
Write a subclass of VelocityViewServlet and overwrite method initVelocity()
with your preferred initialization.
Gabe
--
Gabriel Sidler
Software Engineer, Eivycom GmbH, Zurich, Switzerland
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>