You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by An...@Dell.com on 2007/09/13 00:38:10 UTC
Variable Interpolation not working for me.
I am currently trying to test out the variable Interpolation and cannot
get it to work properly. I am not sure if it is bug or just misuse on my
part as I am new to the commons package. Any help would be much
appreciated.
I load up my configuation files this way and all else seems to work.
config = new
PropertiesConfiguration(pathfilename);
FileChangedReloadingStrategy strat = new
FileChangedReloadingStrategy();
strat.setRefreshDelay(30000);
config.setReloadingStrategy(strat);
My property exists in my main propery file that I use to load other
property files.
include = General.properties
include = DragonfxBeanPoolFactory.properties
include = MsgEventMapping.properties
include = LSPMsgTypeMappings.properties
include = ReportConfig.properties
include = SendingMessage.properties
LOGFILE_PROPERTIES={sys:app_env}_{sys:app_vm}_log4j.xml
My system properties are set using the vm parameter. -Dapp_env=dev
-Dapp_vm=web
They are available when I use system.getProperty to access them. I am
using 1.4 version of the commons jar.
When I get the property it returns the string with the brackets etc like
it cannot find the system property.
Thanks ahead of time for any help you may provide.
Re: Variable Interpolation not working for me.
Posted by Oliver Heger <ol...@oliver-heger.de>.
Anthony_Crouch@Dell.com wrote:
> I am currently trying to test out the variable Interpolation and cannot
> get it to work properly. I am not sure if it is bug or just misuse on my
> part as I am new to the commons package. Any help would be much
> appreciated.
>
> I load up my configuation files this way and all else seems to work.
>
> config = new
> PropertiesConfiguration(pathfilename);
> FileChangedReloadingStrategy strat = new
> FileChangedReloadingStrategy();
> strat.setRefreshDelay(30000);
> config.setReloadingStrategy(strat);
>
> My property exists in my main propery file that I use to load other
> property files.
>
> include = General.properties
> include = DragonfxBeanPoolFactory.properties
> include = MsgEventMapping.properties
> include = LSPMsgTypeMappings.properties
> include = ReportConfig.properties
> include = SendingMessage.properties
> LOGFILE_PROPERTIES={sys:app_env}_{sys:app_vm}_log4j.xml
>
> My system properties are set using the vm parameter. -Dapp_env=dev
> -Dapp_vm=web
>
> They are available when I use system.getProperty to access them. I am
> using 1.4 version of the commons jar.
>
> When I get the property it returns the string with the brackets etc like
> it cannot find the system property.
>
> Thanks ahead of time for any help you may provide.
>
Don't know whether this is really the problem, but you are missing a
'$'. Variables in a configuration file have the form ${...}, so the line
in your properties file should run:
LOGFILE_PROPERTIES=${sys:app_env}_${sys:app_vm}_log4j.xml
Oliver
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org