You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Thomas Vandahl <th...@tewisoft.de> on 2007/06/26 13:45:55 UTC

How to use AvalonLogChute?

Hi folks,

I'm trying to implement a messaging service as an Avalon component. 
There I create a VelocityEngine instance and I would like to pass it the 
Avalon logger I have available in my component. In Velocity 1.5 
AvalonLogChute would seem to be the way to do this. But how do I set my 
logger? The member variable LOGGER is of type String. How is this 
supposed to work?

Bye, Thomas.


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


Re: How to use AvalonLogChute?

Posted by Nathan Bubna <nb...@gmail.com>.
On 7/1/07, Thomas Vandahl <th...@tewisoft.de> wrote:
> Nathan Bubna wrote:
> > 1) the AvalonLogChute class first tries to get its Avalon Logger via
> > Heirarchy.getDefaultHeirarchy().getLoggerFor(<some logger name>).
> > This <some logger name> is null by default but can be set to a valid
> > logger name via the "runtime.log.logsystem.avalon.logger" property in
> > your velocity.properties.  So, it would seem that if you create a
> > logger for <some logger name> in the default log heirarchy and then
> > start up your VelocityEngine using the property:
> >
> > runtime.log.logsystem.avalon.logger=<some logger name>
> >
> > then the AvalonLogChute should use your Logger of choice.  this
> > appears to be the intended pattern by those who first designed the
> > AvalonLogChute
>
> I couldn't get this to work. Somehow, the name of the logger is not easy
> to determine. But even if I set the logger name manually, I see the log
> messages going to the console instead of the log file. So I chose...
>
> > 2) you can create your own LogChute implementation that wraps your
> > Logger and add an instance of this class you created directly to the
> > Properties used to init() your VelocityEngine under the key
> > "runtime.log.logsystem".   Velocity's LogManager always first checks
> > the configuration properties for LogChute under that key before trying
> > any other means to get a LogChute.
>

great. :)  thanks for reporting back!


> Bye, Thomas.
>
>
> ---------------------------------------------------------------------
> 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


Re: How to use AvalonLogChute?

Posted by Thomas Vandahl <th...@tewisoft.de>.
Nathan Bubna wrote:
> 1) the AvalonLogChute class first tries to get its Avalon Logger via
> Heirarchy.getDefaultHeirarchy().getLoggerFor(<some logger name>).
> This <some logger name> is null by default but can be set to a valid
> logger name via the "runtime.log.logsystem.avalon.logger" property in
> your velocity.properties.  So, it would seem that if you create a
> logger for <some logger name> in the default log heirarchy and then
> start up your VelocityEngine using the property:
> 
> runtime.log.logsystem.avalon.logger=<some logger name>
> 
> then the AvalonLogChute should use your Logger of choice.  this
> appears to be the intended pattern by those who first designed the
> AvalonLogChute

I couldn't get this to work. Somehow, the name of the logger is not easy 
to determine. But even if I set the logger name manually, I see the log 
messages going to the console instead of the log file. So I chose...

> 2) you can create your own LogChute implementation that wraps your
> Logger and add an instance of this class you created directly to the
> Properties used to init() your VelocityEngine under the key
> "runtime.log.logsystem".   Velocity's LogManager always first checks
> the configuration properties for LogChute under that key before trying
> any other means to get a LogChute.

That works fine. Thanks for the hint.

Bye, Thomas.


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


Re: How to use AvalonLogChute?

Posted by Nathan Bubna <nb...@gmail.com>.
i see two possible options that don't involve modifying the current
Velocity code...

1) the AvalonLogChute class first tries to get its Avalon Logger via
Heirarchy.getDefaultHeirarchy().getLoggerFor(<some logger name>).
This <some logger name> is null by default but can be set to a valid
logger name via the "runtime.log.logsystem.avalon.logger" property in
your velocity.properties.  So, it would seem that if you create a
logger for <some logger name> in the default log heirarchy and then
start up your VelocityEngine using the property:

runtime.log.logsystem.avalon.logger=<some logger name>

then the AvalonLogChute should use your Logger of choice.  this
appears to be the intended pattern by those who first designed the
AvalonLogChute

2) you can create your own LogChute implementation that wraps your
Logger and add an instance of this class you created directly to the
Properties used to init() your VelocityEngine under the key
"runtime.log.logsystem".   Velocity's LogManager always first checks
the configuration properties for LogChute under that key before trying
any other means to get a LogChute.

On 6/26/07, Thomas Vandahl <th...@tewisoft.de> wrote:
> Hi folks,
>
> I'm trying to implement a messaging service as an Avalon component.
> There I create a VelocityEngine instance and I would like to pass it the
> Avalon logger I have available in my component. In Velocity 1.5
> AvalonLogChute would seem to be the way to do this. But how do I set my
> logger? The member variable LOGGER is of type String. How is this
> supposed to work?
>
> Bye, Thomas.
>
>
> ---------------------------------------------------------------------
> 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