You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Josef Holy <jo...@gmail.com> on 2005/08/23 19:50:17 UTC

[configuration] Getting Properties from the Configuration

Hi,

I have the Configuration, loaded from the .properties file (so it is
actually the instanceof PropertiesConfiguration class). I need to
configure my log4j engine by calling the
PropertyConfigurator.configure(java.util.Properties) method. These
properties for the log4j are the subset of properties loaded
previously into the Configuration instance.

Is there any way how to get the java.util.Properties instance from the
Configuration? There are methods in the AbstractConfiguration class -
subset(prefix) and getProperties(key), but none of them fits my need.

 So my log4j properties seem to be locked in the Configuration and I
can't get them out of it all at once. Or am I wrong?

Thanks for any ideas or responses.

Josef.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [configuration] Getting Properties from the Configuration

Posted by Josef Holy <jo...@gmail.com>.
Henning,

thanks a lot.

-Josef

On 8/23/05, Henning P. Schmiedehausen <hp...@intermeta.de> wrote:
> Josef Holy <jo...@gmail.com> writes:
> 
> >Is there any way how to get the java.util.Properties instance from the
> >Configuration? There are methods in the AbstractConfiguration class -
> >subset(prefix) and getProperties(key), but none of them fits my need.
> 
> http://jakarta.apache.org/commons/configuration/apidocs_1.0/org/apache/commons/configuration/ConfigurationConverter.html
> 
> Configuration log4Conf = conf.subset("log4j");
> PropertiesConfiguration.configure(
>             ConfigurationConverter.getProperties(log4Conf));
> 
> BTDT, works fine. ;-)
> 
>         Regards
>                 Henning
> 
> --
> Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
> hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/
> 
> RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
>    Linux, Java, perl, Solaris -- Consulting, Training, Development
> 
>                       4 - 8 - 15 - 16 - 23 - 42
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 


-- 
josef.holy@subject.cz
http://www.subject.cz/josef

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [configuration] Getting Properties from the Configuration

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
Josef Holy <jo...@gmail.com> writes:

>Is there any way how to get the java.util.Properties instance from the
>Configuration? There are methods in the AbstractConfiguration class -
>subset(prefix) and getProperties(key), but none of them fits my need.

http://jakarta.apache.org/commons/configuration/apidocs_1.0/org/apache/commons/configuration/ConfigurationConverter.html

Configuration log4Conf = conf.subset("log4j");
PropertiesConfiguration.configure(
            ConfigurationConverter.getProperties(log4Conf));

BTDT, works fine. ;-)

	Regards
		Henning

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
   Linux, Java, perl, Solaris -- Consulting, Training, Development

		      4 - 8 - 15 - 16 - 23 - 42

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org