You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Nathan Bubna <na...@esha.com> on 2004/11/11 08:27:03 UTC

[veltools] Of singletons and logging

hey folks,

as you may have noticed, i checked in a bunch of changes tonight to convert
the VelocityView and VelocityStruts servlets and tools from singleton mode to
the use of a VelocityEngine.

this is a Good Thing (tm) that has long been planned and requested.  it does,
however, include what some have claimed to be a Bad Thing (tm):  the use of
commons-logging.  yes, it's true.  VelocityView and VelocityStruts now
primarily use commons-logging to handle log output.  the only exceptions are
the VVS and VLS classes because they have direct access to the VelocityEngine
being used.  for the rest of the classes and tools, it is entirely
unreasonable and bad to be passing a VelocityEngine around merely to allow
them the opportunity to access log facilities.

i had put this off for some time in hopes that a magical solution might be
found in changes to the core velocity logging facilities.  these changes have
not come, and i still doubt that they are wholly feasible.

so, i've begun the (r)evolution.  let all who would protest do so soon and
back it up with working patches for their alternative proposal.  :)

P.S.  if anyone out there is using the RenderTool in a singleton-based app,
don't fear! it still will still work for that just fine.  The same goes for
the LogSystemCommonsLog. :)

Nathan Bubna
nathan@esha.com


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


Re: [veltools] Of singletons and logging

Posted by Shinobu Kawai <sh...@gmail.com>.
Hi Nathan,

> as you may have noticed, i checked in a bunch of changes tonight to convert
> the VelocityView and VelocityStruts servlets and tools from singleton mode to
> the use of a VelocityEngine.
Great job!  The RenderTool fix let all of my JUnit tests be completely
independent of each other.  :)

> this is a Good Thing (tm) that has long been planned and requested.  it does,
> however, include what some have claimed to be a Bad Thing (tm):  the use of
> commons-logging.  yes, it's true.  VelocityView and VelocityStruts now
> primarily use commons-logging to handle log output.  the only exceptions are
> the VVS and VLS classes because they have direct access to the VelocityEngine
> being used.  for the rest of the classes and tools, it is entirely
> unreasonable and bad to be passing a VelocityEngine around merely to allow
> them the opportunity to access log facilities.
> 
> i had put this off for some time in hopes that a magical solution might be
> found in changes to the core velocity logging facilities.  these changes have
> not come, and i still doubt that they are wholly feasible.
> 
> so, i've begun the (r)evolution.  let all who would protest do so soon and
> back it up with working patches for their alternative proposal.  :)
I am completely for this.
    http://issues.apache.org/bugzilla/show_bug.cgi?id=19140

Best regards,
-- Shinobu Kawai

--
Shinobu Kawai <sh...@gmail.com>


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


Re: [veltools] Of singletons and logging

Posted by Nathan Bubna <na...@esha.com>.
Tim Colson said:
> > as you may have noticed, i checked in a bunch of changes
> Nice to have you back. School and work must have slowed down? ;-)

heh.  work slowed down for a little bit.  but i'm still drowning in schoolwork
and probably won't really surface again for a month or two.

> > tonight to convert
> > the VelocityView and VelocityStruts servlets and tools from
> > singleton mode to the use of a VelocityEngine.
> Break it down for those of us who are Stupid (ok -- just me I suppose)...
> what does this change mean at a high-level to dudes like me? What will
> happen?

a.  not much.  for instance, i didn't have to change a thing in the example
apps we ship.  they worked with the changes just fine.

b.  log output from tools and their managing classes will not all be spewed
into the ServletLogger by default anymore.  only the VVS and VLS will still do
this by default (you can, of course, still configure them to do otherwise in
your velocity.properties), because they have direct access to the
VelocityEngine being used and can thus use its LogSystem.  if you want the
rest of VelocityView and/or VelocityStruts to have their log output shipped
into the configured LogSystem for the VVS/VLS, then you will have to configure
commons-logging for your app to use the LogSystemCommonsLog.

c. you can use several different instances or subclasses of
VelocityViewServlet in the same web application and give them each different
velocity.properties configurations.

d. similar to point c., you can use the VVS alongside other servlets or
software that uses the singleton without conflict between them (e.g. Turbine).

and there's probably other ramifications that are presently escaping my brain,
but hopefully this helps a bit. :)

Nathan Bubna
nathan@esha.com


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


RE: [veltools] Of singletons and logging

Posted by Tim Colson <tc...@cisco.com>.
> as you may have noticed, i checked in a bunch of changes 
Nice to have you back. School and work must have slowed down? ;-)


> tonight to convert
> the VelocityView and VelocityStruts servlets and tools from 
> singleton mode to the use of a VelocityEngine.
Break it down for those of us who are Stupid (ok -- just me I suppose)...
what does this change mean at a high-level to dudes like me? What will
happen?

Thanks dude,
Timo


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