Logging going to stdout (or webapp context log?)

Christopher Schultz <[email protected]> Thu, 30 Jan 2014 20:50:18 -0500
Newsgroups gmane.comp.jakarta.velocity.user
Message-ID <[email protected]>
All,

I'm using Velocity 1.7.

I've been suffering with this for a long time and I'm finally going to
deal with it: when running Velocity from a Tomcat-deployed webapp, I get
a ton of log messages in catalina.out (which captures stdout):

INFO:  Velocity  [trace] Searching for properties at:
/org/apache/velocity/tools/view/velocity.properties
Jan 30, 2014 8:21:33 PM org.apache.catalina.core.ApplicationContext log
INFO:  Velocity  [trace] Searching for properties at:
/WEB-INF/velocity.properties
Jan 30, 2014 8:21:33 PM org.apache.catalina.core.ApplicationContext log
INFO:  Velocity  [debug] Configuring Velocity with properties at:
/WEB-INF/velocity.properties
Jan 30, 2014 8:21:33 PM org.apache.catalina.core.ApplicationContext log
INFO:  Velocity  [trace] Searching for properties at:
/WEB-INF/velocity.properties
Jan 30, 2014 8:21:33 PM org.apache.catalina.core.ApplicationContext log
INFO:  Velocity  [debug] Configuring Velocity with properties at:
/WEB-INF/velocity.properties
Jan 30, 2014 8:21:33 PM org.apache.catalina.core.ApplicationContext log
INFO:  Velocity  [debug] Initializing Velocity, Calling init()...
Jan 30, 2014 8:21:33 PM org.apache.catalina.core.ApplicationContext log
INFO:  Velocity  [trace]
*******************************************************************
Jan 30, 2014 8:21:33 PM org.apache.catalina.core.ApplicationContext log
INFO:  Velocity  [debug] Starting Apache Velocity v1.7 (compiled:
2010-11-19 12:14:37)
Jan 30, 2014 8:21:33 PM org.apache.catalina.core.ApplicationContext log
INFO:  Velocity  [trace] RuntimeInstance initializing.
Jan 30, 2014 8:21:33 PM org.apache.catalina.core.ApplicationContext log
INFO:  Velocity  [debug] Default Properties File:
org/apache/velocity/runtime/defaults/velocity.properties
Jan 30, 2014 8:21:33 PM org.apache.catalina.core.ApplicationContext log
INFO:  Velocity  [debug] Trying to use logger class
org.apache.velocity.runtime.log.ServletLogChute
Jan 30, 2014 8:21:33 PM org.apache.catalina.core.ApplicationContext log
INFO:  Velocity  [debug] Using logger class
org.apache.velocity.runtime.log.ServletLogChute
Jan 30, 2014 8:21:33 PM org.apache.catalina.core.ApplicationContext log
INFO:  Velocity  [trace] Default ResourceManager initializing. (class
org.apache.velocity.runtime.resource.ResourceManagerImpl)
Jan 30, 2014 8:21:33 PM org.apache.catalina.core.ApplicationContext log
INFO:  Velocity  [debug] ResourceLoader instantiated:
org.apache.velocity.tools.view.WebappResourceLoader

Etc., etc., etc. It continues after startup:

INFO:  Velocity  [error] Right side ($patients.size()) of '<' operation
has null value at /staff/patients.vm[line 25, column 8]
Jan 30, 2014 8:33:23 PM org.apache.catalina.core.ApplicationContext log
INFO:  Velocity  [debug] ResourceManager : found layout/Default.vm with
loader org.apache.velocity.tools.view.WebappResourceLoader

The configuration reference
(http://velocity.apache.org/engine/releases/velocity-1.7/developer-guide.html#Configuring_Logging)
says that the default logger logs to a file in the current directory,
but that does not appear to be happening.

I'm using VelocityLayoutServlet which claims to "logs to the logging
facility of the servlet API". I can see after tracing through lots of
calls, this finally happens in VelocityView.init:

        // register this engine to be the default handler of log messages
        // if the user points commons-logging to the LogSystemCommonsLog
        LogChuteCommonsLog.setVelocityLog(getLog());

I'm using log4j internally for my own application logging, and most
stuff goes there. In fact, I have several ServletContextListeners that
are using ServletContext.log() to emit log statements, and they all end
up in my log4j log file.

If Velocity is using ServletContext.log (which I would expect, since
VelocityLayoutServlet uses the servlet API's logging facility), I would
expect those log statements above to appear in my log4j log file.

Am I missing something? I'd love to get this stuff out of catalina.out,
because rotating that file is a bit of a pain, and /every/ little error
gets logged there.

Thanks,
-chris
signature.asc (application/pgp-signature, 924 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJS6wFaAAoJEBzwKT+lPKRYV7gP/RVjgS3elOFNClaP2xYRhHv0
YWxbWbYyhjDRbf2GEG43iznMk/Akyt4di+VAjgs2LPw3CIOK8TDiL1ImL1dFn3GD
9S/qDzRS0mgp/xCLcQ8t5v80UT1DRMMgcPY1Q9COABBo4aq0b82WkEFFqHVb04Ec
CC/rcz0/geY1s1Q07Pl7v/CH0OV7sCr0daltjspuRdwODQVkv+J5xlFGiJNU9Q4V
SoTME1yEl/bkO1p0Spr8PuoGNX4CX/d4Gunh6WsQ80XVIPMnesT9b8jxURWAniW4
SC0lOMlYbLbxG6TrMUqfqwrgqkGjVXni81INr77wxjDhHJhAo2xhPFMqxaDLZnNP
an6yo8uXna4ghFzaLMdLvqpRri2N5cpwTYk0uVOAk3Xq01SkmlXSB3Xw7l8a/goo
5XvmAz69g73FdVz1CAxPK9GccTZCJ2EBlgI8wEe0JqbjOBXZqHqv3uzH4pImMf7T
wyXXX98IlvPWGbQ6jeGyEMM82lJ9PIUfynhpah+T8IZuwuISjjiXclOUA7mjlz6M
ivpQc3aLcbpCz5Kxk1NkN9aJr99fz2UPx56Oz70WkVSrd2D1bW6+hYR/NC0YFhx1
7PAWoHr3cXxfdpWaoXSUbI/AXWqNh1mpqz6tbzp6VJlvvZtS15tmkALhnhZNahzq
sSR+YZC04pjUv7Nr4LO4
=VqYo
-----END PGP SIGNATURE-----