[ http://issues.apache.org/jira/browse/VELOCITY-403?page=comments#action_12330722 ]
Nathan Bubna commented on VELOCITY-403: --------------------------------------- Ok, I think I've got this all ready to go. It's a big freakin' patch, but that's mostly because logging is frequently used. The rather hefty summary of changes is below. Please let me know if you see any problems. After this comment, i'll attach the patch (which, of course, compiles and passes all the tests). Changes in this patch: Upgraded LogSystem: - added isLevelEnabled(int level) - added logVelocityMessage(int level, String message, Throwable t) - added TRACE_ID constant - deprecated unused DEBUG_ON constant Upgraded existing LogSystem implementations: - updated Log4JLogSystem with the new methods - updated PrimordialLogSystem with the new methods - updated NullLogSystem with the new methods - updated AvalonLogSystem with the new methods - updated SimpleLog4JLogSystem with the new methods - updated testcases that implement LogSystem with the new methods - ClassloaderChangeTestCase - EventHandlingTestCase - ExternalLoggerTestCase - FilteredEventHandlingTestCase Added new LogSystem implementations: - JdkLogSystem for the java.util.logging services in JDK 1.4+ - StandardOutLogSystem for printing logging to System.out and System.err Added new Log class: - Log class is meant to replace RuntimeLogger interface - also added temporary RuntimeLoggerLog hack as deprecation path - Log class provides more convenience methods for LogSystem functions - Log class takes over some logging code from RuntimeInstance - Log instance may be retrieved from RuntimeServices.getLog() Upgraded LogManager: - createLogSystem(...) now falls back to StandardOutLogSystem on failure - added updateLog(...) to take over Log initialization code from RuntimeInstance Updated RuntimeInstance: - moved logging init code to LogManager and Log - deprecated debug(Object), info(Object), warn(Object), and error(Object) - added getLog() - removed private methods showStackTraces() and log(...) - replaced private LogSystem instance with Log instance - replaced initializeLogger() with simpler initializeLog() code - passed Log to new Introspector instead of self Updated RuntimeServices interface: - added getLog() method Updated default velocity.properties: - added JdkLogSystem as last option of runtime.log.logsystem.class property Updated UberspectLoggable interface: - deprecated setRuntimeLogger(RuntimeLogger) - added setLog(Log) - updated UberspectImpl to reflect these changes - all uberspects on the wiki extend UberspectImpl so these changes won't break them - this is easy for other uberspects to impl; Uberspect writers are very capable Updated classes that directly use RuntimeLogger (*Executors and Introspector): - deprecated ctors that take RuntimeLogger - added ctors that take Log - deprecated ctors forward to new ctor using RuntimeLoggerLog hack - replaced RuntimeLogger refs with Log refs Updated internal classes to use new logging API: - replace calls to RuntimeServices.debug/info/warn/error with RuntimeService.getLog()... - if log messages included an Exception, pass that separately now (i.e. error("Oops!", ex);) - logging was frequently used in a class/subclasses, add a Log reference - if the classes uses few log statements, just s/rsvc.<level>/rsvc.getLog().<level> - classes affected are: Template, VelocimacroFactory, Parser, SimpleNode, ContentResource, ResourceLoader, VelocimacroManager, VelocimacroProxy, ASTStringLiteral, ASTIdentifier, ASTMethod, ASTReference, ASTSetDirective, ASTAndNode, ASTEQNode, ASTNENode, ASTLTNode, ASTGTNode, ASTLENode, ASTGENode, ASTAddNode, ASTSubtractNode, ASTMulNode, ASTDivNode, ASTModNode, EventHandlerUtil, EscapeReference, IncludeNotFound, VMProxyArg, Foreach, Include, Macro, Parse, ASTIntegerRange, ClasspathResourceLoader, DataSourceResourceLoader, RuntimeInstance, ResourceCacheImpl, ResourceManagerImpl, ResourceLoader, FileResourceLoader, JarHolder, JarResourceLoader, ASTIntegerRange, ResourceLoaderFactory > Enhance Velocity's LogSystem and internal use thereof > ----------------------------------------------------- > > Key: VELOCITY-403 > URL: http://issues.apache.org/jira/browse/VELOCITY-403 > Project: Velocity > Type: Improvement > Components: Source > Reporter: Nathan Bubna > Fix For: 1.5 > > After several very, very long debates with Geir over commons-logging, i have > become largely convinced that it is something we should do with hesitation > (i.e. let's talk about it for 2.0, but not before). i've also begun to have > some frustrations with commons-logging in both work projects and in > VelocityTools. > regardless of these issues, it is clear to me that Velocity's LogSystem and > use of it is in great need of improvement. we need to lower the priority of > many messages, eliminate some, and above all, upgrade the system itself to be > more useful. > some specific, unevaluated, off-the-cuff ideas are: > -make logging a null-op if no logger is found, rather than panic and break > -detect jdk 1.4+ logging > -add a trace level > -add is<Level>Enabled > -make it possible to grab a LogSystem instance of sorts, so Velocity > extensions can use it more sensibly (i'm tired of the hacks we must do in > Tools) > those are just a few ideas, and they might not all even be feasible. still, > i'm hoping to take a whack at some of this and hoping that others can help me > out. my volunteer time is still rather limited. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]