You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Justin Lawler <ju...@eircom.net> on 2002/03/08 16:22:33 UTC
Setting logging for Velocity singlton doesnt work
Why is it that when I set a logging system for the VelocityEngine class eg.
VelocityEngine.setProperty (RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new LogSystemImpl());
the logging works, but when i do the same for the Velocity singlton, eg.
Velocity.setProperty (RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new LogSystemImpl());
it just resorts to the SimpleLog4JLogSystem. I had a good look through the code and I cant find any reason why it should do this.
thanks in advance,
Justin
Re: Setting logging for Velocity singlton doesnt work
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 3/8/02 12:06 PM, "Justin Lawler" <ju...@eircom.net> wrote:
> ok, i now know the problem, i was setting the property and then initialising
> velocity with a properties file, so all previously set properties would get
> over writen. Is this intentional behviour or should it add the properties
> from a configuration file if the overriding properties is not null?
It's by design - the idea was that you would glom all of your settings into
one properties, and then pass that in.
Geir
>
>
> ----- Original Message -----
> From: Geir Magnusson Jr. <ge...@optonline.net>
> To: <ve...@jakarta.apache.org>
> Sent: Friday, March 08, 2002 3:27 PM
> Subject: Re: Setting logging for Velocity singlton doesnt work
>
>
>> On 3/8/02 10:22 AM, "Justin Lawler" <ju...@eircom.net> wrote:
>>
>>> Why is it that when I set a logging system for the VelocityEngine class
> eg.
>>> VelocityEngine.setProperty (RuntimeConstants.RUNTIME_LOG_LOGSYSTEM,
> new
>>> LogSystemImpl());
>>>
>>> the logging works, but when i do the same for the Velocity singlton, eg.
>>> Velocity.setProperty (RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new
>>> LogSystemImpl());
>>>
>>> it just resorts to the SimpleLog4JLogSystem. I had a good look through
> the
>>> code and I cant find any reason why it should do this.
>>
>> It should work just fine - the Singleton is just a static wrapper around
> the
>> same RuntimeImpl that the VelocityEngine uses.
>>
>> Are you sure that the singleton hasn't been initialized already? Once
>> Velocity.init() is called, no more configuration is allowed...
>>
>> --
>> Geir Magnusson Jr. geirm@optonline.net
>> System and Software Consulting
>>
>> Age and treachery will always triumph over youth and talent
>>
>>
>> --
>> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>>
>>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
You're going to end up getting pissed at your software
anyway, so you might as well not pay for it. Try Open Source.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Setting logging for Velocity singlton doesnt work
Posted by Justin Lawler <ju...@eircom.net>.
ok, i now know the problem, i was setting the property and then initialising
velocity with a properties file, so all previously set properties would get
over writen. Is this intentional behviour or should it add the properties
from a configuration file if the overriding properties is not null?
----- Original Message -----
From: Geir Magnusson Jr. <ge...@optonline.net>
To: <ve...@jakarta.apache.org>
Sent: Friday, March 08, 2002 3:27 PM
Subject: Re: Setting logging for Velocity singlton doesnt work
> On 3/8/02 10:22 AM, "Justin Lawler" <ju...@eircom.net> wrote:
>
> > Why is it that when I set a logging system for the VelocityEngine class
eg.
> > VelocityEngine.setProperty (RuntimeConstants.RUNTIME_LOG_LOGSYSTEM,
new
> > LogSystemImpl());
> >
> > the logging works, but when i do the same for the Velocity singlton, eg.
> > Velocity.setProperty (RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new
> > LogSystemImpl());
> >
> > it just resorts to the SimpleLog4JLogSystem. I had a good look through
the
> > code and I cant find any reason why it should do this.
>
> It should work just fine - the Singleton is just a static wrapper around
the
> same RuntimeImpl that the VelocityEngine uses.
>
> Are you sure that the singleton hasn't been initialized already? Once
> Velocity.init() is called, no more configuration is allowed...
>
> --
> Geir Magnusson Jr. geirm@optonline.net
> System and Software Consulting
>
> Age and treachery will always triumph over youth and talent
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Setting logging for Velocity singlton doesnt work
Posted by Justin Lawler <ju...@eircom.net>.
yea, it hasnt been initialised. I even called getProperty
(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM) after initialising it and it
returns the same LogSystem implentation. it just doesnt use it for logging.
wierd but ive been through my code and the velocity code many times but i
cant find any reason why i would do this.
----- Original Message -----
From: Geir Magnusson Jr. <ge...@optonline.net>
To: <ve...@jakarta.apache.org>
Sent: Friday, March 08, 2002 3:27 PM
Subject: Re: Setting logging for Velocity singlton doesnt work
> On 3/8/02 10:22 AM, "Justin Lawler" <ju...@eircom.net> wrote:
>
> > Why is it that when I set a logging system for the VelocityEngine class
eg.
> > VelocityEngine.setProperty (RuntimeConstants.RUNTIME_LOG_LOGSYSTEM,
new
> > LogSystemImpl());
> >
> > the logging works, but when i do the same for the Velocity singlton, eg.
> > Velocity.setProperty (RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new
> > LogSystemImpl());
> >
> > it just resorts to the SimpleLog4JLogSystem. I had a good look through
the
> > code and I cant find any reason why it should do this.
>
> It should work just fine - the Singleton is just a static wrapper around
the
> same RuntimeImpl that the VelocityEngine uses.
>
> Are you sure that the singleton hasn't been initialized already? Once
> Velocity.init() is called, no more configuration is allowed...
>
> --
> Geir Magnusson Jr. geirm@optonline.net
> System and Software Consulting
>
> Age and treachery will always triumph over youth and talent
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Setting logging for Velocity singlton doesnt work
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 3/8/02 10:22 AM, "Justin Lawler" <ju...@eircom.net> wrote:
> Why is it that when I set a logging system for the VelocityEngine class eg.
> VelocityEngine.setProperty (RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new
> LogSystemImpl());
>
> the logging works, but when i do the same for the Velocity singlton, eg.
> Velocity.setProperty (RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new
> LogSystemImpl());
>
> it just resorts to the SimpleLog4JLogSystem. I had a good look through the
> code and I cant find any reason why it should do this.
It should work just fine - the Singleton is just a static wrapper around the
same RuntimeImpl that the VelocityEngine uses.
Are you sure that the singleton hasn't been initialized already? Once
Velocity.init() is called, no more configuration is allowed...
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
Age and treachery will always triumph over youth and talent
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>