You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Richard Lamuette <tu...@laposte.net> on 2003/04/03 12:59:11 UTC
Log4j Problem
Velocity 1.3.1 final
Log4j 1.2.8
I have no ouput from Velocity, with the followin conf :
1/ log4j.properties in the classpath
2/ log4j.logger.org.apache.velocity=DEBUG added in my log4j.properties
Is there something special to do after ?
Thank u for this newbie question.
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
RE: Log4j Problem
Posted by Richard Lamuette <tu...@laposte.net>.
My toolbox and my velocity.properties are loaded, because they reflect
changes I do, so I'm not promising, i'm sure ;-)
I begin to debug the code, and i can notice, runtime.log.logsystem.class and
runtime.log.logsystem.log4j.category are used only if runtime.log.logsystem
is not initialized, and in my case, it is initialized to ServletLogger. So I
assume that VelocityViewServlet is the trouble, i keep debugging ...
-----Message d'origine-----
De : Nathan Bubna [mailto:nathan@esha.com]
Envoyé : vendredi 4 avril 2003 16:59
À : Velocity Users List
Objet : Re: Log4j Problem
Richard said:
...
> And a part from my velocity.properties (it is located in the WEB-INF
folder,
> and I promise it is used by velocity)
promises, promises... proof from a log would be better! ;-)
> The related part from my web.xml :
...
> <init-param>
> <param-name>toolbox</param-name>
> <param-value>/WEB-INF/toolbox.xml</param-value>
> </init-param>
> <init-param>
> <param-name>properties</param-name>
> <param-value>/WEB-INF/velocity.properties</param-value>
> </init-param>
...
if you are using the current CVS of velocity-tools, then your toolbox
and your velocity.properties are NOT being loaded.
the param-names for these files have been changed. in your web.xml they
should now look like:
<init-param>
<param-name>org.apache.velocity.toolbox</param-name>
<param-value>/somedir/toolbox.xml</param-value>
</init-param>
<init-param>
<param-name>org.apache.velocity.properties</param-name>
<param-value>/someotherdir/velocity.properties</param-value>
</init-param>
the param name for velocity.properties was changed thusly in Velocity 1.4's
VelocityServlet and the old one was deprecated. when the
VelocityViewServlet was made independent of the VelocityServlet a few weeks
back, the support for the deprecated one was dropped (velocity-tools has no
formal release and thus is not concerned with being B.C. yet) and the
param-name for the toolbox file was changed to match. i apologize that we
have not yet gotten documentation out there that show this, but at least the
example applications and javadoc do reflect this change.
Nathan Bubna
nathan@esha.com
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Log4j Problem
Posted by Nathan Bubna <na...@esha.com>.
Richard said:
> I worked with an intermediate nightly build of velocity-tools,
this info would have made a world of difference at the start :)
i was under the impression it was the current CVS you were working with.
> and i found
> the bug in VelocityViewServlet that initialized ServletLogger for
> runtime.log.logsystem.
yep, a bug long known but only recently fixed.
> Ok, instead fixing it, i turn to the last nightly build, rewrite web.xml
> with your conf, i changed the class package in the toolbox.xml, and .. it
> works !!!!!!!!
great!! glad i was able to help!
Nathan Bubna
nathan@esha.com
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
RE: Log4j Problem
Posted by Richard Lamuette <tu...@laposte.net>.
I worked with an intermediate nightly build of velocity-tools, and i found
the bug in VelocityViewServlet that initialized ServletLogger for
runtime.log.logsystem.
Ok, instead fixing it, i turn to the last nightly build, rewrite web.xml
with your conf, i changed the class package in the toolbox.xml, and .. it
works !!!!!!!!
Thank you for your support, nathan.
Richard.
-----Message d'origine-----
De : Nathan Bubna [mailto:nathan@esha.com]
Envoyé : vendredi 4 avril 2003 16:59
À : Velocity Users List
Objet : Re: Log4j Problem
Richard said:
...
> And a part from my velocity.properties (it is located in the WEB-INF
folder,
> and I promise it is used by velocity)
promises, promises... proof from a log would be better! ;-)
> The related part from my web.xml :
...
> <init-param>
> <param-name>toolbox</param-name>
> <param-value>/WEB-INF/toolbox.xml</param-value>
> </init-param>
> <init-param>
> <param-name>properties</param-name>
> <param-value>/WEB-INF/velocity.properties</param-value>
> </init-param>
...
if you are using the current CVS of velocity-tools, then your toolbox
and your velocity.properties are NOT being loaded.
the param-names for these files have been changed. in your web.xml they
should now look like:
<init-param>
<param-name>org.apache.velocity.toolbox</param-name>
<param-value>/somedir/toolbox.xml</param-value>
</init-param>
<init-param>
<param-name>org.apache.velocity.properties</param-name>
<param-value>/someotherdir/velocity.properties</param-value>
</init-param>
the param name for velocity.properties was changed thusly in Velocity 1.4's
VelocityServlet and the old one was deprecated. when the
VelocityViewServlet was made independent of the VelocityServlet a few weeks
back, the support for the deprecated one was dropped (velocity-tools has no
formal release and thus is not concerned with being B.C. yet) and the
param-name for the toolbox file was changed to match. i apologize that we
have not yet gotten documentation out there that show this, but at least the
example applications and javadoc do reflect this change.
Nathan Bubna
nathan@esha.com
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Log4j Problem
Posted by Nathan Bubna <na...@esha.com>.
Richard said:
...
> And a part from my velocity.properties (it is located in the WEB-INF
folder,
> and I promise it is used by velocity)
promises, promises... proof from a log would be better! ;-)
> The related part from my web.xml :
...
> <init-param>
> <param-name>toolbox</param-name>
> <param-value>/WEB-INF/toolbox.xml</param-value>
> </init-param>
> <init-param>
> <param-name>properties</param-name>
> <param-value>/WEB-INF/velocity.properties</param-value>
> </init-param>
...
if you are using the current CVS of velocity-tools, then your toolbox
and your velocity.properties are NOT being loaded.
the param-names for these files have been changed. in your web.xml they
should now look like:
<init-param>
<param-name>org.apache.velocity.toolbox</param-name>
<param-value>/somedir/toolbox.xml</param-value>
</init-param>
<init-param>
<param-name>org.apache.velocity.properties</param-name>
<param-value>/someotherdir/velocity.properties</param-value>
</init-param>
the param name for velocity.properties was changed thusly in Velocity 1.4's
VelocityServlet and the old one was deprecated. when the
VelocityViewServlet was made independent of the VelocityServlet a few weeks
back, the support for the deprecated one was dropped (velocity-tools has no
formal release and thus is not concerned with being B.C. yet) and the
param-name for the toolbox file was changed to match. i apologize that we
have not yet gotten documentation out there that show this, but at least the
example applications and javadoc do reflect this change.
Nathan Bubna
nathan@esha.com
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
RE: Log4j Problem
Posted by Richard Lamuette <tu...@laposte.net>.
You are right, i didnt provide you for many data to solve the problem.
My Log4j.properties :
log4j.rootLogger=INFO, stdout, logfile
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{dd-MM-yyyy HH:mm:ss} %5p
%c:%L - %m%n
log4j.appender.logfile=org.apache.log4j.RollingFileAppender
log4j.appender.logfile.Threshold=WARN
log4j.appender.logfile.File=application.log
log4j.appender.logfile.MaxFileSize=100KB
log4j.appender.logfile.MaxBackupIndex=1
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern=%d{dd-MM-yyyy HH:mm:ss} %5p
%c:%L - %m%n
# Looging Level for the Application
log4j.logger.com.xxx.yyy=DEBUG
# Control logging for Struts and Commons classes
log4j.logger.org.apache.commons=INFO
log4j.logger.org.apache.struts=INFO
# All hibernate log output of "info" level or higher goes to stdout.
# For more verbose logging, change the "info" to "debug" on the last line.
log4j.logger.cirrus.hibernate.ps.PreparedStatementCache=INFO
log4j.logger.cirrus.hibernate=INFO
# Control logging for Velocity classes
log4j.logger.org.apache.velocity=DEBUG
And a part from my velocity.properties (it is located in the WEB-INF folder,
and I promise it is used by velocity)
runtime.log.error.stacktrace = false
runtime.log.warn.stacktrace = false
runtime.log.info.stacktrace = false
runtime.log.invalid.reference = true
runtime.log.logsystem.class =
org.apache.velocity.runtime.log.SimpleLog4JLogSystem
runtime.log.logsystem.log4j.category = org.apache.velocity
The related part from my web.xml :
<!-- Define Velocity template compiler -->
<servlet>
<servlet-name>velocity</servlet-name>
<servlet-class>org.apache.velocity.tools.view.servlet.VelocityViewServlet</s
ervlet-class>
<init-param>
<param-name>toolbox</param-name>
<param-value>/WEB-INF/toolbox.xml</param-value>
</init-param>
<init-param>
<param-name>properties</param-name>
<param-value>/WEB-INF/velocity.properties</param-value>
</init-param>
<load-on-startup>10</load-on-startup>
</servlet>
<!-- Map *.vm files to Velocity -->
<servlet-mapping>
<servlet-name>velocity</servlet-name>
<url-pattern>*.vm</url-pattern>
</servlet-mapping>
I hope it can help you
Thank you a lot, Nathan.
Richard.
-----Message d'origine-----
De : Nathan Bubna [mailto:nathan@esha.com]
Envoyé : jeudi 3 avril 2003 20:02
À : Velocity Users List
Objet : Re: Log4j Problem
Richard said:
> I'm sorry Nathan, but it doesnt work for me. I've added :
> "log4j.logger.org.apache.velocity=DEBUG, stdout" in my log4j.properties.
> Nothing appears in the console... :-(
> I'm using Log4j 1.2.8 and the last version of velocity 1.3.1 final
your versions are fine, and it doesn't help to just tell me it doesn't work.
you need to tell what it is doing, if there's errors, and then, if it's not
doing anything and there are no errors, you need to give more of your
configuration info (web.xml entry, velocity.properties, full
log4j.properties, etc).
when you changed your velocity.properties to use log4j, did it stop
outputting messages to the servlet log?
are you sure your velocity.properties is being used?
and do you have your "stdout" logger defined as a ConsoleAppender?
try using this for your log4j.properties:
log4j.rootLogger=DEBUG, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
Nathan Bubna
nathan@esha.com
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Log4j Problem
Posted by Nathan Bubna <na...@esha.com>.
Richard said:
> I'm sorry Nathan, but it doesnt work for me. I've added :
> "log4j.logger.org.apache.velocity=DEBUG, stdout" in my log4j.properties.
> Nothing appears in the console... :-(
> I'm using Log4j 1.2.8 and the last version of velocity 1.3.1 final
your versions are fine, and it doesn't help to just tell me it doesn't work.
you need to tell what it is doing, if there's errors, and then, if it's not
doing anything and there are no errors, you need to give more of your
configuration info (web.xml entry, velocity.properties, full
log4j.properties, etc).
when you changed your velocity.properties to use log4j, did it stop
outputting messages to the servlet log?
are you sure your velocity.properties is being used?
and do you have your "stdout" logger defined as a ConsoleAppender?
try using this for your log4j.properties:
log4j.rootLogger=DEBUG, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
Nathan Bubna
nathan@esha.com
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
RE: Log4j Problem
Posted by Richard Lamuette <tu...@laposte.net>.
I'm sorry Nathan, but it doesnt work for me. I've added :
"log4j.logger.org.apache.velocity=DEBUG, stdout" in my log4j.properties.
Nothing appears in the console... :-(
I'm using Log4j 1.2.8 and the last version of velocity 1.3.1 final
-----Message d'origine-----
De : Nathan Bubna [mailto:nathan@esha.com]
Envoyé : jeudi 3 avril 2003 17:08
À : Velocity Users List
Objet : Re: Log4j Problem
Richard said:
> I'm using Tomcat+Struts+Velocity+Velocity-Tools.
> It's not possible to use Log4J ?
it is possible. i do it all the time, but it's not set up to "auto-detect"
log4j and use it. you have to specify that you want Velocity to use log4j
in your velocity.properties. something like this is appropriate:
runtime.log.logsystem.class =
org.apache.velocity.runtime.log.SimpleLog4JLogSystem
runtime.log.logsystem.log4j.category = org.apache.velocity
Nathan Bubna
nathan@esha.com
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Log4j Problem
Posted by Nathan Bubna <na...@esha.com>.
Richard said:
> I'm using Tomcat+Struts+Velocity+Velocity-Tools.
> It's not possible to use Log4J ?
it is possible. i do it all the time, but it's not set up to "auto-detect"
log4j and use it. you have to specify that you want Velocity to use log4j
in your velocity.properties. something like this is appropriate:
runtime.log.logsystem.class =
org.apache.velocity.runtime.log.SimpleLog4JLogSystem
runtime.log.logsystem.log4j.category = org.apache.velocity
Nathan Bubna
nathan@esha.com
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
RE: Log4j Problem
Posted by Richard Lamuette <tu...@laposte.net>.
I'm using Tomcat+Struts+Velocity+Velocity-Tools.
It's not possible to use Log4J ?
Richard.
-----Message d'origine-----
De : Teemu Kanstren [mailto:teka@mail.student.oulu.fi]
Envoye : jeudi 3 avril 2003 14:01
A : Velocity Users List
Objet : Re: Log4j Problem
On Thu, 3 Apr 2003, Richard Lamuette wrote:
> Velocity 1.3.1 final
> Log4j 1.2.8
>
> I have no ouput from Velocity, with the followin conf :
> 1/ log4j.properties in the classpath
> 2/ log4j.logger.org.apache.velocity=DEBUG added in my log4j.properties
Are you using Velocity with servlets and the tools-subproject, etc. (or
whatever it is called) ? I think it logs to the servlet containers default
logfile, if using tomcat then to tomcat/logs/<logfilename>.txt. If you are
just using it some other way, I guess this won't help you then :).
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Log4j Problem
Posted by Teemu Kanstrén <te...@mail.student.oulu.fi>.
On Thu, 3 Apr 2003, Richard Lamuette wrote:
> Velocity 1.3.1 final
> Log4j 1.2.8
>
> I have no ouput from Velocity, with the followin conf :
> 1/ log4j.properties in the classpath
> 2/ log4j.logger.org.apache.velocity=DEBUG added in my log4j.properties
Are you using Velocity with servlets and the tools-subproject, etc. (or
whatever it is called) ? I think it logs to the servlet containers default
logfile, if using tomcat then to tomcat/logs/<logfilename>.txt. If you are
just using it some other way, I guess this won't help you then :).
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org