You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Peter Sojan <il...@gmx.net> on 2002/04/14 04:06:33 UTC

vm autoreload per velocity.properties ignored !?

Hi!

Today I upgraded from 1.2 to 1.3-RC1. Since that my VM-macros didnt get
autoreloaded any more. My velocity.properties:

------------------------------------------
runtime.log.invalid.references = true
runtime.log.error.stacktrace = false
runtime.log.warn.stacktrace = false
runtime.log.info.stacktrace = false

resource.loader = file
file.resource.loader.description = Velocity File Resource Loader
file.resource.loader.class = org.apache.velocity.runtime.resource.loader.FileResourceLoader
file.resource.loader.path = .
file.resource.loader.cache = false
file.resource.loader.modificationCheckInterval = 2

velocimacro.library = common/vm/GlobalVars.vm, common/vm/Common.vm, common/vm/Navigation.vm, common/vm/PageTemplate.vm, common/vm/Resource.vm, common/vm/Error.vm 
velocimacro.library.autoreload = true 
------------------------------------------

In my Velocity initialization code I load in the properties file. I found out 
that if I do: 

 p.setProperty( Velocity.VM_LIBRARY_AUTORELOAD, "true");

just before:
 
 Velocity.init(p);

everything works again ...

Anything new here?

so long
Peter

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


Re: vm autoreload per velocity.properties ignored !?

Posted by Peter Sojan <il...@gmx.net>.
> Hm.  There were some fixes, but not intentional changes.
> 
> To summarize - if you don't do the p.setProperty(), then you don't get it?
> Are you sure?  Because from what you are showing, the above properties
> should work just fine.
>

Yes  .. 

> W/o the p.setProperty() do you see any message in the .log?  It will log the
> state of 'autoreload'.
> 

Yes, the log then says autoreload: off 

Here is what I´m doing exactly: 

---------------------------------------------

    // get our properties file and load it
    String propsFile = WebFrontendManager.getInstance().getVelocityPropertiesFile();
    cat.debug("Loading properties file: " + propsFile);
    Properties p = new Properties();        
    try {
      p.load( new FileInputStream(propsFile) );       

    } catch (Exception e) {
      ....
    } 
    
    
    //  now, if there is a file loader resource path, normalize it
    String path = p.getProperty( Velocity.FILE_RESOURCE_LOADER_PATH );

    if ( path != null) {
      path = sc.getRealPath( path );      
      if ( path != null) {
	p.setProperty( Velocity.FILE_RESOURCE_LOADER_PATH, path );
      }
    }

    // this is necessary, a bug !?
    p.setProperty( Velocity.VM_LIBRARY_AUTORELOAD, "true");

    // set up logging
    String velocity_log_category = "Velocity";
    Category velocity_log = Category.getInstance( velocity_log_category );
    p.setProperty( RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,
		   "org.apache.velocity.runtime.log.SimpleLog4JLogSystem" );
    p.setProperty("runtime.log.logsystem.log4j.category", velocity_log_category);

    

    cat.debug("Firing up Velocity engine ... ");
    try {
      Velocity.init(p);
    } catch (Exception e) {
      ....
    } 

---------------------------------------------

so long
Peter



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


Re: vm autoreload per velocity.properties ignored !?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 4/13/02 10:06 PM, "Peter Sojan" <il...@gmx.net> wrote:

> 
> Hi!
> 
> Today I upgraded from 1.2 to 1.3-RC1. Since that my VM-macros didnt get
> autoreloaded any more. My velocity.properties:
> 
> ------------------------------------------
> runtime.log.invalid.references = true
> runtime.log.error.stacktrace = false
> runtime.log.warn.stacktrace = false
> runtime.log.info.stacktrace = false
> 
> resource.loader = file
> file.resource.loader.description = Velocity File Resource Loader
> file.resource.loader.class =
> org.apache.velocity.runtime.resource.loader.FileResourceLoader
> file.resource.loader.path = .
> file.resource.loader.cache = false
> file.resource.loader.modificationCheckInterval = 2
> 
> velocimacro.library = common/vm/GlobalVars.vm, common/vm/Common.vm,
> common/vm/Navigation.vm, common/vm/PageTemplate.vm, common/vm/Resource.vm,
> common/vm/Error.vm
> velocimacro.library.autoreload = true
> ------------------------------------------
> 
> In my Velocity initialization code I load in the properties file. I found out
> that if I do: 
> 
> p.setProperty( Velocity.VM_LIBRARY_AUTORELOAD, "true");
> 
> just before:
> 
> Velocity.init(p);
> 
> everything works again ...
> 
> Anything new here?

Hm.  There were some fixes, but not intentional changes.

To summarize - if you don't do the p.setProperty(), then you don't get it?
Are you sure?  Because from what you are showing, the above properties
should work just fine.

W/o the p.setProperty() do you see any message in the .log?  It will log the
state of 'autoreload'.


-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Somebody has to do something, and it's just incredibly pathetic that it has
to be us.  - Jerry Garcia


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