You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Paul Fraser <pa...@qnenet.com> on 2023/01/17 22:25:51 UTC
Access config properties programmatically
Hi,
The karaf docs state "Apache Karaf stores and loads all configuration in
files located in the |etc| folder."
To access and/or set properties in code do the files have to be loaded
as properties files in code and then saved back after changes or does
karaf have a simple method to manipulate properties?
Karaf docs and googling for a way to set "log level" in code provides a
very confusing array of suggestions.
Karaf test code seems to use executeCommand to do it using the console
commands.
Paul Fraser
Re: Access config properties programmatically
Posted by Cesar Garcia <ce...@ceos.com.ve>.
How are you?
If you check the programming of the commands associated with the management
of the configuration, you will be able to observe the methodology used. It
is more instructive than tests, in my experience.
I have some example that you can check in this repository[1].
I hope it is useful,
1. https://github.com/glcj/Merlot/tree/master/com.ceos.merlot.iotdb.svr
El mar, 17 ene 2023 a las 18:27, Paul Fraser (<pa...@qnenet.com>) escribió:
> Hi,
>
> The karaf docs state "Apache Karaf stores and loads all configuration in
> files located in the etc folder."
>
> To access and/or set properties in code do the files have to be loaded as
> properties files in code and then saved back after changes or does karaf
> have a simple method to manipulate properties?
>
> Karaf docs and googling for a way to set "log level" in code provides a
> very confusing array of suggestions.
>
> Karaf test code seems to use executeCommand to do it using the console
> commands.
>
> Paul Fraser
>
--
*CEOS Automatización, C.A.*
*GALPON SERVICIO INDUSTRIALES Y NAVALES FA, C.A.,*
*PISO 1, OFICINA 2, AV. RAUL LEONI, SECTOR GUAMACHITO,*
*FRENTE A LA ASOCIACION DE GANADEROS,BARCELONA,EDO. ANZOATEGUI*
*Ing. César García*
*Cel: +58 414-760.98.95*
*Hotline Técnica SIEMENS: 0800 1005080*
*Email: support.aan.automation@siemens.com
<su...@siemens.com>*
Re: Access config properties programmatically
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Paul,
Just use ConfigiurationAsmin service, the loading and persistency is
managed by Karaf on top of ConfigAdmin.
Regards
JB
On Tue, Jan 17, 2023 at 11:25 PM Paul Fraser <pa...@qnenet.com> wrote:
>
> Hi,
>
> The karaf docs state "Apache Karaf stores and loads all configuration in files located in the etc folder."
>
> To access and/or set properties in code do the files have to be loaded as properties files in code and then saved back after changes or does karaf have a simple method to manipulate properties?
>
> Karaf docs and googling for a way to set "log level" in code provides a very confusing array of suggestions.
>
> Karaf test code seems to use executeCommand to do it using the console commands.
>
> Paul Fraser