with Velocity 1.4, there are three ways.  which one you use depends on
how you are using Velocity:

if you are using the singleton, then just replace the println()s with
Velocity.debug("log me")/info()/warn()/error() calls.

if you are using a VelocityEngine, you must have access to that engine
in order to do:  engine.debug("log me")/info()/warn()/error() calls.

(please note that these two methods are deprecated in Velocity 1.5, as
i have introduced a getLog() method to the Velocity and VelocityEngine
classes.  that way, you can get the Log object and call the
trace()/debug()/info()/etc methods on that, passing it around at will
regardless of whether it comes from the singleton or an engine.)

the third method requires VelocityTools (at least the
velocity-tools-generic-1.1.jar) and Commons-Logging.  you'll need to
wisely use the Commons-Logging <-> LogSystem bridges.  but this can be
a bit hairy if you are using Tomcat 5.5 (which wholly relies on
Commons-Logging), and i don't really have time to go into that right
now.  nor do i particularlly recommend it.  so you're on your own for
now if you take that route. :)

On 11/8/05, Andrew Mason <[EMAIL PROTECTED]> wrote:
> Hi, I am using Tomcat 5.5 with Velocity 1.4 (the dep jar) and i currently have
> a whole load of System.out.println()'s through out my code meaning my
> catalina.out file is getting quite large. Since velocity already logs
> to /velocity.log i was wondering if it was possible to replace all the
> System.out's i have in my velocity servlets and use the same logger velocity
> uses (i.e so they all go to /velocity.log instead).
> If so, how would i go about doing this.
>
> Many thanks
>
> Andrew M
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to