You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Geir Magnusson Jr." <ge...@optonline.net> on 2001/11/17 14:04:23 UTC

Logging enhancements

As discussed, there are a few new changes to the logging system to make life
better.

Summary : 

Things work as before.  If you use the latest no-dependency jar,  and if you
take logkit out of the classpath and put in log4j, it will use a simple,
file-based log4j logger.  If you want a logkit based logger, use that jar in
the classpath.  Velocity figures it out.


In detail :

First, there is a new log4j-based logging class called SimpleLog4JLogSystem
with does two things

1) Accepts a property "runtime.log.logsystem.log4j.category" which can
contain the name of an existing log4j category, so that you can setup an
arbitrarily complicated category in your application, and just pass the name
to Velocity, and it will use it.

2) if the above isn't present, it will just log to a file specified by
"runtime.log", the usual property.

To use this as your logger, you need log4j in the classpath of course, and
then just set the property

  runtime.log.logsystem.class

to be 

 org.apache.velocity.runtime.log.SimpleLog4JLogSystem



Second, the log management system has a slightly modified algorithm for
doing things :

1) It will first see if the application has passed in a living object to use
as the logger (as before).

2) If that fails, it will get the runtime.log.logsystem.class property, and
try every class listed.  It will use the first one that it finds.  The
default value of the property has both the logkit and log4j (simple)
loggers, so now if you don't do anything, Velocity will use whichever it
finds in the classpath - so if you put in the logkit jar, it uses that, if
the log4j jar, it uses log4j.  If both, it uses logkit :)  (Thanks to Jason
for the idea of just using whatever was in the classpath...)

If you want to turn off this automatic mode, just specify the one you want
via the runtime.log.logsystem.class property.



Finally, if it can't find anything that is specified, it turns to one last
gasp for air, trying to use a logkit logger, and will blather to stdout and
stderr if it cant - at this point, things are so misconfigured, we can't go
further...

Code is in CVS HEAD.  Give it a wack.  If all goes well, will document.

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety." - Benjamin Franklin



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Logging enhancements

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 11/17/01 1:41 PM, "Nick Bauman" <ni...@cortexity.com> wrote:

> Can I still use my own logging system using an adapter?

Of course :)

Nothing has changed in that way.

The only changes you will see as a user is that it will automatically use
log4j if you put log4j in the classpath, just like you would if you put the
logkit jar in the classpath (with the new dependency-free jar build...)

If there is a problem, yell, because this shouldn't affect existing
functionality...

geir


> 
>> 
>> As discussed, there are a few new changes to the logging system to make
>> life better.
>> 
>> Summary : 
>> 
>> Things work as before.  If you use the latest no-dependency jar,  and
>> if you take logkit out of the classpath and put in log4j, it will use a
>> simple, file-based log4j logger.  If you want a logkit based logger,
>> use that jar in the classpath.  Velocity figures it out.
>> 
>> 
>> In detail :
>> 
>> First, there is a new log4j-based logging class called
>> SimpleLog4JLogSystem with does two things
>> 
>> 1) Accepts a property "runtime.log.logsystem.log4j.category" which can
>> contain the name of an existing log4j category, so that you can setup
>> an arbitrarily complicated category in your application, and just pass
>> the name to Velocity, and it will use it.
>> 
>> 2) if the above isn't present, it will just log to a file specified by
>> "runtime.log", the usual property.
>> 
>> To use this as your logger, you need log4j in the classpath of course,
>> and then just set the property
>> 
>>   runtime.log.logsystem.class
>> 
>> to be 
>> 
>>  org.apache.velocity.runtime.log.SimpleLog4JLogSystem
>> 
>> 
>> 
>> Second, the log management system has a slightly modified algorithm for
>> doing things :
>> 
>> 1) It will first see if the application has passed in a living object
>> to use as the logger (as before).
>> 
>> 2) If that fails, it will get the runtime.log.logsystem.class property,
>> and try every class listed.  It will use the first one that it finds.
>> The default value of the property has both the logkit and log4j
>> (simple) loggers, so now if you don't do anything, Velocity will use
>> whichever it finds in the classpath - so if you put in the logkit jar,
>> it uses that, if the log4j jar, it uses log4j.  If both, it uses logkit
>> :)  (Thanks to Jason for the idea of just using whatever was in the
>> classpath...)
>> 
>> If you want to turn off this automatic mode, just specify the one you
>> want via the runtime.log.logsystem.class property.
>> 
>> 
>> 
>> Finally, if it can't find anything that is specified, it turns to one
>> last gasp for air, trying to use a logkit logger, and will blather to
>> stdout and stderr if it cant - at this point, things are so
>> misconfigured, we can't go further...
>> 
>> Code is in CVS HEAD.  Give it a wack.  If all goes well, will document.
>> 
>> -- 
>> Geir Magnusson Jr.
>> geirm@optonline.net System and Software Consulting
>> "They that can give up essential liberty to obtain a little temporary
>> safety deserve neither liberty nor safety." - Benjamin Franklin
>> 
>> 
>> 
>> --
>> 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
Be a giant.  Take giant steps.  Do giant things...


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Logging enhancements

Posted by Nick Bauman <ni...@cortexity.com>.
Can I still use my own logging system using an adapter?

> 
> As discussed, there are a few new changes to the logging system to make
> life better.
> 
> Summary : 
> 
> Things work as before.  If you use the latest no-dependency jar,  and
> if you take logkit out of the classpath and put in log4j, it will use a
> simple, file-based log4j logger.  If you want a logkit based logger,
> use that jar in the classpath.  Velocity figures it out.
> 
> 
> In detail :
> 
> First, there is a new log4j-based logging class called
> SimpleLog4JLogSystem with does two things
> 
> 1) Accepts a property "runtime.log.logsystem.log4j.category" which can
> contain the name of an existing log4j category, so that you can setup
> an arbitrarily complicated category in your application, and just pass
> the name to Velocity, and it will use it.
> 
> 2) if the above isn't present, it will just log to a file specified by
> "runtime.log", the usual property.
> 
> To use this as your logger, you need log4j in the classpath of course,
> and then just set the property
> 
>   runtime.log.logsystem.class
> 
> to be 
> 
>  org.apache.velocity.runtime.log.SimpleLog4JLogSystem
> 
> 
> 
> Second, the log management system has a slightly modified algorithm for
> doing things :
> 
> 1) It will first see if the application has passed in a living object
> to use as the logger (as before).
> 
> 2) If that fails, it will get the runtime.log.logsystem.class property,
> and try every class listed.  It will use the first one that it finds. 
> The default value of the property has both the logkit and log4j
> (simple) loggers, so now if you don't do anything, Velocity will use
> whichever it finds in the classpath - so if you put in the logkit jar,
> it uses that, if the log4j jar, it uses log4j.  If both, it uses logkit
> :)  (Thanks to Jason for the idea of just using whatever was in the
> classpath...)
> 
> If you want to turn off this automatic mode, just specify the one you
> want via the runtime.log.logsystem.class property.
> 
> 
> 
> Finally, if it can't find anything that is specified, it turns to one
> last gasp for air, trying to use a logkit logger, and will blather to
> stdout and stderr if it cant - at this point, things are so
> misconfigured, we can't go further...
> 
> Code is in CVS HEAD.  Give it a wack.  If all goes well, will document.
> 
> -- 
> Geir Magnusson Jr.                                    
> geirm@optonline.net System and Software Consulting
> "They that can give up essential liberty to obtain a little temporary
> safety deserve neither liberty nor safety." - Benjamin Franklin
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org> For additional
> commands, e-mail: <ma...@jakarta.apache.org>


-- 
Nick Bauman 
Cortexity Development
Intellectual Process is more important than
Intellectual Property -- you'll see.
http://www.cortexity.com/


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>