You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Uwe Geercken <u....@global-nav.com> on 2003/07/09 16:04:43 UTC

velocity log problem

hello,

I am desperately trying to get rid of a problem, but it persists no matter
what I do.

I have created a web application. a java class parses an xml file and merges
the object with a velocity template. this does work as far as my tests at
home show. now I copied all the necessary files onto a webserver. when a
call to velocity is made, following error occurs:

org.apache.jasper.JasperException: Unable to configure AvalonLogSystem :
java.io.FileNotFoundException: /var/tomcat4/velocity.log (Permission denied)


ok. this error is ok because the directory is protected and velocity can not
write its log.

so I tried to set the properties before the velocity init() method, but it
does not seem to work. nomatter how I set the properties, I always get this
same error.

here is the code of the class:

==================
    private String templatePath;
    private static final String RESOURCE_PATH                  =
"file.resource.loader.path";
    private static final String RUNTIME_LOG                    =
"runtime.log";
    private static final String RUNTIME_LOG_AVALON             =
"runtime.log.logsystem.avalon.logger";
    private static final String RUNTIME_LOG_LOGSYSTEM_CLASS    =
"runtime.log.logsystem.class";
    private static final String RUNTIME_LOG_ERROR_STACKTRACE   =
"runtime.log.error.stacktrace";
    private static final String RUNTIME_LOG_WARN_STACKTRACE    =
"runtime.log.warn.stacktrace";
    private static final String RUNTIME_LOG_INFO_STACKTRACE    =
"runtime.log.info.stacktrace";
    private static final String RUNTIME_LOG_INVALID_REFERENCES =
"runtime.log.invalid.references";

    private String templateName;
    private Properties properties = new Properties();
    private Template t;

    public VelocityDataWriter(String templatePath, String templateName)
throws Exception
    {
        this.templatePath = templatePath;
        this.templateName = templateName;
        properties.setProperty(RESOURCE_PATH, templatePath);

properties.setProperty(RUNTIME_LOG,"/home/global-n/public_html/java-global-n
/WEB-INF/errors/velocity.log");

properties.setProperty(RUNTIME_LOG_AVALON,"/home/global-n/public_html/java-g
lobal-n/WEB-INF/errors/velocity.log");

properties.setProperty(RUNTIME_LOG_LOGSYSTEM_CLASS,"com.globalnav.util.veloc
ity.VelocityDataWriter");
        properties.setProperty(RUNTIME_LOG_ERROR_STACKTRACE, "false");
        properties.setProperty(RUNTIME_LOG_WARN_STACKTRACE, "false");
        properties.setProperty(RUNTIME_LOG_INFO_STACKTRACE, "false");
        properties.setProperty(RUNTIME_LOG_INVALID_REFERENCES,"false");
        VelocityEngine ve = new VelocityEngine();
        ve.init(properties);
        t = ve.getTemplate(templateName);


=====================

could somebody please help me to understand and solve the problem?

thanks.

uwe geercken


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


Re: velocity log problem

Posted by Daniel Rall <dl...@finemaltcoding.com>.
"Uwe Geercken" <u....@global-nav.com> writes:
...
> you mail was very much useless.
> 
> bye.

Attitude of that sort is not required around here.  Take a hike,
buddy.
-- 

Daniel Rall

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


Re: velocity log problem

Posted by Nathan Bubna <na...@esha.com>.
Uwe Geercken said:
...
> - the runtime.log.logsystem.avalon.logger - quote: "Allows user to specify
> an existing logger name in the avalon hierachy...". the error I received
> from tomcat was :org.apache.jasper.JasperException: Unable to configure
> AvalonLogSystem : java.io.FileNotFoundException: /var/tomcat4/velocity.log
> (Permission denied).

again, i ask you, are you really getting only that same exact error message
every time?  your first email indicated you got that at first and then tried
to change log settings and still got the same message.  if that's the case,
then you have more serious problems than even the ones that the code you sent
demonstrated, because it means that some other properties are getting set.
oh, and then there's the fact that it's a JasperException.  are you using
Veltag or otherwise trying to run Velocity within a JSP?  something is funky
with your setup.  have you even tried to get the logging examples in the
documentation to work?

anyway, i was trying to help you, but since you don't answer my questions and
can't seem to fathom that you might be doing things wrong, i can't.

and since when is

"/home/global-n/public_html/java-global-n/WEB-INF/errors/velocity.log"

an existing logger name in the avalon heirarchy?  you specified a file name,
not a logger name, not to mention that you said you were using your own
LogSystem implementation and not the AvalonLogSystem.  do you even have LogKit
setup with your application?  seriously, as i said right off the bat, the
value you set for that property is completely wrong, and as i said in my
second email, you probably shouldn't even be bothering with that property.

> - it was the first time, I asked something on this mailing list. I am a
> developer - why is this mailing list wrong? on the jakarta-apache website
> they say it's for developers. I am not a user.

you are *using* velocity to develop your application.  you are a *user.*  in
the apache world,  dev lists are for those interested in the development *of*
the project (in this case, velocity), not for those having problems developing
*with* velocity.  either way, you are a newcomer on this list and are not
making any friends with your arrogant, ungrateful, inconsiderate attitude.  if
you don't drop it, no one is going to help you.  remember, people here are
volunteers and don't owe you jack squat.  some would consider you lucky to
have even gotten a response to a user list question here.

> - maybe you answered my question badly...

no.  i did not.

now, i'm done dealing with you here.  i suggest you go clean up your original
question and post it on the user list.  i will give a little time to see if
someone else will take the time to help you.  if no one does in the next few
days, i'll see if i can't help you figure out what else you're doing wrong
with the logging setup.

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: velocity log problem

Posted by Tim Colson <tc...@cisco.com>.
Uwe -
  I don't understand the logging issue, but I can explain the difference
between the two lists.

velocity-user is for folks who are USERS of velocity 
velocity-developer is for folks who are DEVELOPERS working ON the
Velocity.jar

This separation of lists is fairly common, and explained in the Jakarta
guidelines (http://jakarta.apache.org/site/mail.html). Most everyone on
both lists are 'developers'... but this list is primarly for the folks
working on the Velocity project and sub-projects.

Tim


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


RE: velocity log problem

Posted by Uwe Geercken <u....@global-nav.com>.
- I know that the constants are already in RuntimeConstants
- the runtime.log.logsystem.avalon.logger - quote: "Allows user to specify
an existing logger name in the avalon hierachy...". the error I received
from tomcat was :org.apache.jasper.JasperException: Unable to configure
AvalonLogSystem : java.io.FileNotFoundException: /var/tomcat4/velocity.log
(Permission denied).
- it was the first time, I asked something on this mailing list. I am a
developer - why is this mailing list wrong? on the jakarta-apache website
they say it's for developers. I am not a user.
- maybe you answered my question badly...


uwe geercken

-----Original Message-----
From: Nathan Bubna [mailto:nathan@esha.com]
Sent: Mittwoch, 9. Juli 2003 18:58
To: Velocity Developers List
Subject: Re: velocity log problem


Uwe Geercken said:
...
> if you hadn't cut away the constants in the code, you would have seen,
that
> these are valid keys. they come from the documentation under: "velocity
> configuration keys and values" and indeed are valid key/value
combinations.

i *did* read all of your code.  they are indeed valid *keys*, i never said
they weren't!  sheesh.  i was trying to tell you that the values you were
setting for them were wrong.  i cut away the rest of the code, because i
wasn't responding to it!  get a grip.  i'm volunteering to help you here and
trying to be nice about it.

>     private static final String RUNTIME_LOG                    =
> "runtime.log"
>     private static final String RUNTIME_LOG_AVALON             =
> "runtime.log.logsystem.avalon.logger";

you might also find it useful to know that you needn't create these
constants
yourself.  they are already in the RuntimeConstants interface.

http://jakarta.apache.org/velocity/api/org/apache/velocity/runtime/RuntimeCo
ns
tants.html

> the VelocityDataWriter class implements the LogSystem class.

information that might have been useful if you'd sent it.  i'm not psychic
you
know.  oh, and if you are implementing the LogSystem class yourself, then
why
on earth are you messing with the AvalonLogSystem property(ies) and getting
errors about not being able to configure the AvalonLogSystem?

> ... and I have read the documentation.

well, maybe, but judging by the email you sent (the only info i have to work
from) that didn't appear to be the case.  again, i'm not psychic, and from
this email you still don't appear to understand the function of the
runtime.log.logsystem.avalon.logger property.  i suggest a little more
careful
reading.  double-checking doesn't hurt either.  heck, i even did that before
responding to your email.

> you mail was very much useless.

hey now, you asked a question with answers i felt are covered in the
documentation.  not only that, but you asked it in a non-concise manner on
the
wrong mailing list.  i tried to help.  if you got an answer that didn't help
you, then that's typically because you asked a bad question or asked a good
question badly.  at least i tried to help, you don't have to be a jerk about
it.

again, you should really read this:
http://www.catb.org/~esr/faqs/smart-questions.html  (no smiley this time)

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


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


Re: velocity log problem

Posted by Nathan Bubna <na...@esha.com>.
Uwe Geercken said:
...
> if you hadn't cut away the constants in the code, you would have seen, that
> these are valid keys. they come from the documentation under: "velocity
> configuration keys and values" and indeed are valid key/value combinations.

i *did* read all of your code.  they are indeed valid *keys*, i never said
they weren't!  sheesh.  i was trying to tell you that the values you were
setting for them were wrong.  i cut away the rest of the code, because i
wasn't responding to it!  get a grip.  i'm volunteering to help you here and
trying to be nice about it.

>     private static final String RUNTIME_LOG                    =
> "runtime.log"
>     private static final String RUNTIME_LOG_AVALON             =
> "runtime.log.logsystem.avalon.logger";

you might also find it useful to know that you needn't create these constants
yourself.  they are already in the RuntimeConstants interface.

http://jakarta.apache.org/velocity/api/org/apache/velocity/runtime/RuntimeCons
tants.html

> the VelocityDataWriter class implements the LogSystem class.

information that might have been useful if you'd sent it.  i'm not psychic you
know.  oh, and if you are implementing the LogSystem class yourself, then why
on earth are you messing with the AvalonLogSystem property(ies) and getting
errors about not being able to configure the AvalonLogSystem?

> ... and I have read the documentation.

well, maybe, but judging by the email you sent (the only info i have to work
from) that didn't appear to be the case.  again, i'm not psychic, and from
this email you still don't appear to understand the function of the
runtime.log.logsystem.avalon.logger property.  i suggest a little more careful
reading.  double-checking doesn't hurt either.  heck, i even did that before
responding to your email.

> you mail was very much useless.

hey now, you asked a question with answers i felt are covered in the
documentation.  not only that, but you asked it in a non-concise manner on the
wrong mailing list.  i tried to help.  if you got an answer that didn't help
you, then that's typically because you asked a bad question or asked a good
question badly.  at least i tried to help, you don't have to be a jerk about
it.

again, you should really read this:
http://www.catb.org/~esr/faqs/smart-questions.html  (no smiley this time)

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: velocity log problem

Posted by Uwe Geercken <u....@global-nav.com>.
nathan,

if you hadn't cut away the constants in the code, you would have seen, that
these are valid keys. they come from the documentation under: "velocity
configuration keys and values" and indeed are valid key/value combinations.

    private static final String RUNTIME_LOG                    =
"runtime.log"
    private static final String RUNTIME_LOG_AVALON             =
"runtime.log.logsystem.avalon.logger";


the VelocityDataWriter class implements the LogSystem class.

... and I have read the documentation.

you mail was very much useless.

bye.

-----Original Message-----
From: Nathan Bubna [mailto:nathan@esha.com]
Sent: Mittwoch, 9. Juli 2003 18:20
To: Velocity Developers List
Subject: Re: velocity log problem


Uwe Geercken said:

this is a question that should be asked on the velocity-user list, but to be
nice...

...
> org.apache.jasper.JasperException: Unable to configure AvalonLogSystem :
> java.io.FileNotFoundException: /var/tomcat4/velocity.log (Permission
denied)
...
> so I tried to set the properties before the velocity init() method, but it
> does not seem to work. nomatter how I set the properties, I always get
this
> same error.

the same exact error?  little differences can often matter a lot.

> here is the code of the class:

you should trim any example code you post to a minimum necessary to
duplicate
the problem.

...
> properties.setProperty(RUNTIME_LOG_AVALON,"/home/global-
> n/public_html/java-global-n/WEB-INF/errors/velocity.log");
>
> properties.setProperty(RUNTIME_LOG_LOGSYSTEM_CLASS,
> "com.globalnav.util.velocity.VelocityDataWriter");

these properties are set totally wrong.  the first should be a name of an
existing logger in the Avalon heirarchy, not a log output file path, and the
second should be set to a class that implements Velocity's LogSystem
interface.  Velocity provides an AvalonLogSystem class for you.  you need to
read what the different log properties are for!

http://jakarta.apache.org/velocity/developer-guide.html#Velocity%20Configura
ti
on%20Keys%20and%20Values

you should probably also read this and maybe try to get an example working
first to get the hang of things:

http://jakarta.apache.org/velocity/developer-guide.html#Configuring%20the%20
Lo
g%20System

documentation is your friend. :)

if you still can't figure it out, i suggest posting your question (perhaps
cleaned up a bit) on the user list.

this is good reading too:
http://www.catb.org/~esr/faqs/smart-questions.html
:-)

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


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


Re: velocity log problem

Posted by Nathan Bubna <na...@esha.com>.
Uwe Geercken said:

this is a question that should be asked on the velocity-user list, but to be
nice...

...
> org.apache.jasper.JasperException: Unable to configure AvalonLogSystem :
> java.io.FileNotFoundException: /var/tomcat4/velocity.log (Permission denied)
...
> so I tried to set the properties before the velocity init() method, but it
> does not seem to work. nomatter how I set the properties, I always get this
> same error.

the same exact error?  little differences can often matter a lot.

> here is the code of the class:

you should trim any example code you post to a minimum necessary to duplicate
the problem.

...
> properties.setProperty(RUNTIME_LOG_AVALON,"/home/global-
> n/public_html/java-global-n/WEB-INF/errors/velocity.log");
>
> properties.setProperty(RUNTIME_LOG_LOGSYSTEM_CLASS,
> "com.globalnav.util.velocity.VelocityDataWriter");

these properties are set totally wrong.  the first should be a name of an
existing logger in the Avalon heirarchy, not a log output file path, and the
second should be set to a class that implements Velocity's LogSystem
interface.  Velocity provides an AvalonLogSystem class for you.  you need to
read what the different log properties are for!

http://jakarta.apache.org/velocity/developer-guide.html#Velocity%20Configurati
on%20Keys%20and%20Values

you should probably also read this and maybe try to get an example working
first to get the hang of things:

http://jakarta.apache.org/velocity/developer-guide.html#Configuring%20the%20Lo
g%20System

documentation is your friend. :)

if you still can't figure it out, i suggest posting your question (perhaps
cleaned up a bit) on the user list.

this is good reading too:  http://www.catb.org/~esr/faqs/smart-questions.html
:-)

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