On Thu, Jun 10, 2010 at 12:25 AM, nodje <[email protected]> wrote:
...
>>> I'm getting confusing logs though, I wish someone could help me
>>> understand them.
>>> First of all, I'm using Velocity in a web environnement as a replacement
>>> to JSPs.
>>
>>>>yes, but how.  are you using VelocityViewServlet?  can you share the
>>>>relevant portions of your web.xml?
>>
>> Yes, using VelocityViewServlet, configured this way:
>>
>> <servlet>
>>         <servlet-name>velocity</servlet-name>
>>
>> <servlet-class>org.apache.velocity.tools.view.VelocityViewServlet</servlet-class>
>>         <init-param>
>>             <param-name>org.apache.velocity.tools</param-name>
>>             <param-value>/WEB-INF/tools.xml</param-value>
>>         </init-param>
>>         <init-param>
>>             <param-name>org.apache.velocity.properties</param-name>
>>             <param-value>/WEB-INF/velocity.properties</param-value>
>>         </init-param>
>>         <load-on-startup>3</load-on-startup>
>>     </servlet>
>>
>>> I'm getting the log twice, probably from Velocity, then Tools - isn't it?
>>
>>>>No, there are two Engine startups here, and neither look to be
>>>>triggered by tools since both indicate auto-init being triggered,
>>>>whereas the startup of VelocityViewServlet/Filter/Tag should always
>>>>"manually" init the Engine to be used.  So both "waves" are confusing
>>>>to me.
>>
>> The only explanation I can think of is an instance of VelocityEngine that
>> is injected by Spring in our main AbstractCommonService for email
>> templating purpose. That's probably auto-inited, though I don't understand
>> what triggers the init.
>> If this explains the logs, is there a way to unify the two instances?

Yeah, i'm sure the Spring instance is a separate Engine.  I'm not sure
how to unify them offhand.  I did some experimental
SpringMVC/VelocityTools2 integration a couple years ago, but i'm not
sure where the code is nor how up to date it is.  If i find it, i'll
try and share.

>>> Here's the first wave:
>>>
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Starting Apache
>>> Velocity
>>> v1.6.4 (compiled: 2010-04-27 15:31:23)
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Default Properties
>>> File:
>>> org/apache/velocity/runtime/defaults/velocity.properties
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | LogSystem has been
>>> deprecated. Please use a LogChute implementation. --> I have
>>> runtime.log.logsystem.class =
>>> org.apache.velocity.runtime.log.Log4JLogChute
>>> in velocity.properties, as indicated in the documentation. Why this log?
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | ResourceLoader
>>> instantiated:
>>> org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
>>
>>>>Are you sure you don't have a different velocity.properties in play?
>>>>Because ClasspathResourceLoader and any/all LogSystems are NOT default
>>>>properties.  These settings have to come from somewhere else.
>>
>> Also probably explained by the VelocityEngine being injected and
>> auto-inited in our AbstractCommonService, right? Because, no
>> velocity.properties is defined for this instance.
>>
>> So same question here, how to unify?
>>
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | ResourceCache:
>>> initialized (class
>>> org.apache.velocity.runtime.resource.ResourceCacheImpl)
>>> with class java.util.Collections$SynchronizedMap cache map.
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Loaded System
>>> Directive:
>>> org.apache.velocity.runtime.directive.Define
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Loaded System
>>> Directive:
>>> org.apache.velocity.runtime.directive.Break
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Loaded System
>>> Directive:
>>> org.apache.velocity.runtime.directive.Evaluate
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Loaded System
>>> Directive:
>>> org.apache.velocity.runtime.directive.Literal
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Loaded System
>>> Directive:
>>> org.apache.velocity.runtime.directive.Macro
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Loaded System
>>> Directive:
>>> org.apache.velocity.runtime.directive.Parse
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Loaded System
>>> Directive:
>>> org.apache.velocity.runtime.directive.Include
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Loaded System
>>> Directive:
>>> org.apache.velocity.runtime.directive.Foreach
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocity was not
>>> initialized! Calling init()...
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocity was not
>>> initialized! Calling init()...
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocity was not
>>> initialized! Calling init()...
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocity was not
>>> initialized! Calling init()...
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocity was not
>>> initialized! Calling init()...
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocity was not
>>> initialized! Calling init()...
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocity was not
>>> initialized! Calling init()...
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocity was not
>>> initialized! Calling init()...
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocity was not
>>> initialized! Calling init()...
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocity was not
>>> initialized! Calling init()...
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocity was not
>>> initialized! Calling init()...
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocity was not
>>> initialized! Calling init()...
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocity was not
>>> initialized! Calling init()...
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocity was not
>>> initialized! Calling init()...
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocity was not
>>> initialized! Calling init()...
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocity was not
>>> initialized! Calling init()...
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocity was not
>>> initialized! Calling init()...
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocity was not
>>> initialized! Calling init()...
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocity was not
>>> initialized! Calling init()...
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocity was not
>>> initialized! Calling init()...
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Created '20' parsers.
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocimacro :
>>> allowInline = true : VMs can be defined inline in templates
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocimacro :
>>> allowInlineToOverride = false : VMs defined inline may NOT replace
>>> previous
>>> VM definitions
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocimacro :
>>> allowInlineLocal = false : VMs defined inline will be global in scope if
>>> allowed.
>>> DEBUG [main] VelocityEngine.logVelocityMessage:52 | Velocimacro :
>>> autoload
>>> off : VM system will not automatically reload global library macros
>>>
>>>
>>> Second wave gives:
>>>
>>> DEBUG [main] velocity.log:168 | Log4JLogChute using logger
>>> 'org.apache.velocity'
>>
>>>>ok, this looks like the setting you expected.
>>
>>> DEBUG [main] velocity.log:168 | Configuring Velocity with properties at:
>>> /WEB-INF/velocity.properties
>>> DEBUG [main] velocity.log:168 | Configuring Velocity with properties at:
>>> /WEB-INF/velocity.properties -- Why twice?
>>
>>>> i'm not sure.
>>
>> BTW, is it possible to get the real source class that issued the log
>> instead of "DEBUG [main] velocity.log:168 |" ???
>>
>>> DEBUG [main] velocity.log:168 | Starting Apache Velocity v1.6.4
>>> (compiled:
>>> 2010-04-27 15:31:23)
>>> DEBUG [main] velocity.log:168 | Default Properties File:
>>> org/apache/velocity/runtime/defaults/velocity.properties
>>> DEBUG [main] velocity.log:168 | Trying to use logger class
>>> org.apache.velocity.runtime.log.Log4JLogChute
>>> DEBUG [main] velocity.log:168 | Using logger class
>>> org.apache.velocity.runtime.log.Log4JLogChute
>>> DEBUG [main] velocity.log:168 | ResourceLoader instantiated:
>>> org.apache.velocity.tools.view.WebappResourceLoader
>>> DEBUG [main] velocity.log:168 | ResourceLoader instantiated:
>>> org.apache.velocity.runtime.resource.loader.StringResourceLoader
>>> DEBUG [main] velocity.log:168 | Creating string repository using class
>>> org.apache.velocity.runtime.resource.util.StringResourceRepositoryImpl...
>>
>>>> ok, the resource loader settings look like Tools is involved, but
>>>> then...
>>
>>> DEBUG [main] velocity.log:168 | Default repository encoding is UTF-8
>>> DEBUG [main] velocity.log:168 | ResourceCache: initialized (class
>>> org.apache.velocity.runtime.resource.ResourceCacheImpl) with class
>>> java.util.Collections$SynchronizedMap cache map.
>>> DEBUG [main] velocity.log:168 | Loaded System Directive:
>>> org.apache.velocity.runtime.directive.Define
>>> DEBUG [main] velocity.log:168 | Loaded System Directive:
>>> org.apache.velocity.runtime.directive.Break
>>> DEBUG [main] velocity.log:168 | Loaded System Directive:
>>> org.apache.velocity.runtime.directive.Evaluate
>>> DEBUG [main] velocity.log:168 | Loaded System Directive:
>>> org.apache.velocity.runtime.directive.Literal
>>> DEBUG [main] velocity.log:168 | Loaded System Directive:
>>> org.apache.velocity.runtime.directive.Macro
>>> DEBUG [main] velocity.log:168 | Loaded System Directive:
>>> org.apache.velocity.runtime.directive.Parse
>>> DEBUG [main] velocity.log:168 | Loaded System Directive:
>>> org.apache.velocity.runtime.directive.Include
>>> DEBUG [main] velocity.log:168 | Loaded System Directive:
>>> org.apache.velocity.runtime.directive.Foreach
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>
>>>> ...why all of these?  Tools does not generally allow auto-init to
>>>> happen.  Somehow, something is trying to use the VelocityEngine before
>>>> Tools can init() it.   Are you using the VelocityViewServlet?  If so,
>>>> are you extending it to override any methods?
>>
>> Not sure here, what do you think? Could this also be caused by the other
>> VelocityEngine instance?
>>
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>> DEBUG [main] velocity.log:168 | Created '20' parsers.
>>> DEBUG [main] velocity.log:168 | Velocimacro : adding VMs from VM library
>>> :
>>> /WEB-INF/VM_global_library.vm
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>> DEBUG [main] velocity.log:168 | Velocity was not initialized! Calling
>>> init()...
>>> DEBUG [main] velocity.log:168 | Velocimacro : allowInline = true : VMs
>>> can
>>> be defined inline in templates
>>> DEBUG [main] velocity.log:168 | Velocimacro : allowInlineToOverride =
>>> false
>>> : VMs defined inline may NOT replace previous VM definitions
>>> DEBUG [main] velocity.log:168 | Velocimacro : allowInlineLocal = false :
>>> VMs
>>> defined inline will be global in scope if allowed.
>>> DEBUG [main] velocity.log:168 | Velocimacro : autoload off : VM system
>>> will
>>> not automatically reload global library macros
>>> DEBUG [main] velocity.log:168 | Did not find resource at:
>>> /WEB-INF/toolbox.xml -- I don't think I told velocity to look for
>>> toolbox.xml. Is that a normal log?
>>
>>>>Yes.  Tools 1.x looked for this automatically.  For backwards
>>>>compatibility, Tools 2 does also.
>>
>> Got it.
>>
>>> DEBUG [main] velocity.log:168 | Loaded configuration from:
>>> /WEB-INF/tools.xml
>>> DEBUG [main] velocity.log:168 | Loaded configuration from:
>>> /WEB-INF/tools.xml
>>> DEBUG [main] velocity.log:168 | Configuring factory with:
>>> FactoryConfiguration from 8 sources including 4 data with 3 toolboxes:
>>>  Toolbox 'application' with 1 properties [scope -auto-> application; ]
>>> and
>>> 12 tools:
>>>  Tool 'alternator' => org.apache.velocity.tools.generic.AlternatorTool
>>>  Tool 'class' => org.apache.velocity.tools.generic.ClassTool
>>>  Tool 'convert' => org.apache.velocity.tools.generic.ConversionTool
>>>  Tool 'date' => org.apache.velocity.tools.generic.DateTool with 1
>>> properties [format -auto-> dd/MM/yyyy; ]
>>>  Tool 'display' => org.apache.velocity.tools.generic.DisplayTool
>>>  Tool 'esc' => org.apache.velocity.tools.generic.EscapeTool
>>>  Tool 'field' => org.apache.velocity.tools.generic.FieldTool
>>>  Tool 'math' => org.apache.velocity.tools.generic.MathTool
>>>  Tool 'number' => org.apache.velocity.tools.generic.NumberTool
>>>  Tool 'sorter' => org.apache.velocity.tools.generic.SortTool
>>>  Tool 'text' => org.apache.velocity.tools.generic.ResourceTool
>>>  Tool 'xml' => org.apache.velocity.tools.generic.XmlTool
>>>
>>>  Toolbox 'request' with 1 properties [scope -auto-> request; ] and 15
>>> tools:
>>>  Tool 'context' => org.apache.velocity.tools.view.ViewContextTool
>>>  Tool 'cookies' => org.apache.velocity.tools.view.CookieTool
>>>  Tool 'errors' => org.apache.velocity.tools.struts.ErrorsTool
>>>  Tool 'form' => org.apache.velocity.tools.struts.FormTool
>>>  Tool 'import' => org.apache.velocity.tools.view.ImportTool
>>>  Tool 'include' => org.apache.velocity.tools.view.IncludeTool
>>>  Tool 'link' => org.apache.velocity.tools.struts.StrutsLinkTool
>>>  Tool 'loop' => org.apache.velocity.tools.generic.LoopTool
>>>  Tool 'messages' => org.apache.velocity.tools.struts.ActionMessagesTool
>>>  Tool 'pager' => org.apache.velocity.tools.view.PagerTool
>>>  Tool 'params' => org.apache.velocity.tools.view.ParameterTool
>>>  Tool 'render' => org.apache.velocity.tools.generic.RenderTool
>>>  Tool 'text' => org.apache.velocity.tools.struts.MessageTool
>>>  Tool 'tiles' => org.apache.velocity.tools.struts.TilesTool
>>>  Tool 'validator' => org.apache.velocity.tools.struts.ValidatorTool
>>>
>>>  Toolbox 'session' with 2 properties [createSession -auto-> false; scope
>>> -auto-> session; ] and 1 tools:
>>>  Tool 'browser' => org.apache.velocity.tools.view.BrowserTool
>>>
>>>  Data 'GENERIC_TOOLS_AVAILABLE' -boolean-> true
>>>  Data 'STRUTS_TOOLS_AVAILABLE' -boolean-> true
>>>  Data 'TOOLS_VERSION' -number-> 2.0
>>>  Data 'VIEW_TOOLS_AVAILABLE' -boolean-> true
>>>
>>>  Source 0:
>>> org.apache.velocity.tools.config.FactoryConfiguration(VelocityView.configure(config,factory))
>>>  Source 1:
>>> org.apache.velocity.tools.config.XmlFactoryConfiguration(ConfigurationUtils.getDefaultTools())
>>>  Source 2:
>>> .read(jar:file:/Users/nodje/Documents/project/work/project/target/project/WEB-INF/lib/velocity-tools-2.0.jar!/org/apache/velocity/tools/generic/tools.xml)
>>>  Source 3:
>>> .read(jar:file:/Users/nodje/Documents/project/work/project/target/project/WEB-INF/lib/velocity-tools-2.0.jar!/org/apache/velocity/tools/view/tools.xml)
>>>  Source 4:
>>> .read(jar:file:/Users/nodje/Documents/project/work/project/target/project/WEB-INF/lib/velocity-tools-2.0.jar!/org/apache/velocity/tools/struts/tools.xml)
>>>  Source 5:
>>> org.apache.velocity.tools.config.FactoryConfiguration(ConfigurationUtils.getAutoLoaded(false))
>>>  Source 6:
>>> org.apache.velocity.tools.config.XmlFactoryConfiguration(ServletUtils.getConfiguration(/WEB-INF/tools.xml,ServletContext[,depMode=true]))
>>>  Source 7:
>>> org.apache.velocity.tools.config.XmlFactoryConfiguration(ServletUtils.getConfiguration(/WEB-INF/tools.xml,ServletContext[,depMode=true]))
>>>
>>> The exemple provided in the upgrade to 2.0 page for tools.xml actually
>>> doesn't work, it should be:
>>>
>>>
>>>
>>
>>>>it should be what??
>>
>> Sorry, it didn't make it to the email, don't know why. Here again, it
>> should be fully named class DateTool instead o just 'date'
>>
>> <toolbox scope="application">
>>         <tool class="org.apache.velocity.tools.generic.DateTool"
>> format="dd/MM/yyyy" />
>> </toolbox>
>>
>>>
>>>
>>>
>>> If "date" is used instead of the fully qualified calss name, an error is
>>> reported.
>>>
>>> cheers,
>>> nodje
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Upgrading-to-Tools-2.0---1.6.4%2C-sorting-out-log-messages-tp28804764p28804764.html
>>> Sent from the Velocity - Dev mailing list archive at Nabble.com.
>>>
>>
>> Thanks a lot for your help and for Velocity, I love it.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>>
>
> --
> View this message in context: 
> http://old.nabble.com/Upgrading-to-Tools-2.0---1.6.4%2C-sorting-out-log-messages-tp28804764p28839693.html
> Sent from the Velocity - Dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to