[configuration] Getting Properties from the Configuration

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[configuration] Getting Properties from the Configuration

Josef Holy
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [configuration] Getting Properties from the Configuration

Henning Schmiedehausen
Josef Holy <[hidden email]> 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
[hidden email]        +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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [configuration] Getting Properties from the Configuration

Josef Holy
Henning,

thanks a lot.

-Josef

On 8/23/05, Henning P. Schmiedehausen <[hidden email]> wrote:

> Josef Holy <[hidden email]> 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
> [hidden email]        +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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
[hidden email]
http://www.subject.cz/josef

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