velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Bubna" <nbu...@gmail.com>
Subject Re: Velocity Logging
Date Tue, 07 Oct 2008 23:48:45 GMT
On Tue, Oct 7, 2008 at 4:25 PM, Mark Fenbers <Mark.Fenbers@noaa.gov> wrote:
>
>> ok, leaving method aside for the moment, what logging properties are
>> you setting?
>>
>
> The only change I made to the Apache-supplied velocity.properties file were
> to the runtime.log.logsystem.class property by eliminating the supplied list
> and leaving only the Log4JLogChute.  And I changed runtime.log to have a
> value of ./logs/velocity.log.  And these changes do work.  In my code, I
> currently only do a Velocity.init("bin/velocites.properties");  and I had to
> be explicit where the file was because it wouldn't read it otherwise.

that's good to hear that the changes work.  still, it doesn't quite
answer my question (i think, it seems open to interpretation).  to be
clear, is your "bin/velocites.properties" file a modified copy of the
default one?  or does it only have the runtime.log.logsystem.class and
runtime.log lines in it?

>> did you set a property for runtime.log.logsystem.log4j.logger?  if so,
>> then you are telling Velocity to send message there, rather than set
>> up its own logger.  With Velocity's Log4jLogChute, the runtime.log
>> property is only relevant if velocity is picking the logger.  We try
>> to be a good citizen and not add file appender's to other people's
>> loggers.
>>
>
> No, I didn't.  In the properties file, the only place where the string
> "log4j" appears is in the Log4JLogChute line I mentioned above.  So does
> this mean that velocity is picking its own logger?

yeah, assuming we are talking about Velocity 1.5 or more recent, in
the absence of a specified logger, Log4jLogChute uses the logger
created by:

Logger.getLogger(Log4JLogChute.class.getName());

then, if there is a runtime.log property, it creates a
RollingFileAppender for it.  See

http://svn.apache.org/repos/asf/velocity/engine/trunk/src/java/org/apache/velocity/runtime/log/Log4JLogChute.java

once Velocity is init'ed you can grab that logger yourself and do
whatever you want with it.

> Thanks for the help.  I am assuming you are asking your questions to clarify
> your understanding of the situation with the ultimate goal in mind to help
> me configure Velocity to use a different filename for each instance of of
> app launched, right?

just trying to help you get to your goal, whatever that is.  if it is
a different filename for each instance, then i recommend you try
having only the properties you are changing in your
"bin/velocites.properties" file, and then take the runtime.log
property out of that too.  then you should be able to do:

Velocity.setProperty("runtime.log", filenameForThisInstance);
Velocity.init("bin/velocites.properties");

which ought to work, unless i misunderstand your setup.

> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

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


Mime
View raw message