You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2014/01/31 02:50:18 UTC
Logging going to stdout (or webapp context log?)
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
Re: Logging going to stdout (or webapp context log?)
Posted by Greg Huber <gr...@gmail.com>.
Chris,
Have you checked line 25 column 8 to make sure its not null? ie $patients
is not null?
INFO: Velocity [error] Right side ($patients.size()) of '<' operation
has null value at /staff/patients.vm[line 25, column 8]
this is my log4j setting
# Velocity talks a lot
log4j.category.org.apache.velocity=WARN
Cheers Greg
On 31 January 2014 01:50, Christopher Schultz
<ch...@christopherschultz.net>wrote:
> 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
>
>