On Thursday 19 July 2007 21:42, Wouter de Vaal wrote:

>                                       ServiceReference ref =
> OsgiServiceUtils.getService(context, ConfigurationAdmin.class, null);
>
>                                       ConfigurationAdmin admin = 
> (ConfigurationAdmin)
> context.getService(ref);
>                                       Configuration logConfig =
> admin.getConfiguration("org.ops4j.pax.logging");
>                                       Dictionary properties = 
> logConfig.getProperties();
>                                       if (properties == null){
>                                               properties = new Hashtable();
>                                       }
>                                       properties.put("Log4J-LoggerName", 
> "stdout");
>                                       properties.put("Log4J-ConfigFile",
> "file:logging/log4j.properties"); logConfig.update(properties);

Wow, first time I see a direct usage of the service. We normally use a Config 
Admin plugin, for instance to read from properties files.

Anyway, the above code *may* be correct (I think Edward would know exactly), 
but you either need to populate the logConfig with the log4j Properties 
directly or provide a URL to a .properties or .xml file for log4j.


> When I restart equinox I do get the following warning so I guess it
> tries to match the configuration to the service:
> 0    [Start Level Event Dispatcher] WARN  [undefined]  - Configuration
> for service.pid=org.ops4j.pax.logging could not be bound to
> [EMAIL PROTECTED]:file:../../../work/external-bundles/eclipse-targets/ops4j
>/target/plugins/org.ops4j.pax.logging.service_0.9.4.jar/ event [STARTED] for
> bundle [org.ops4j.pax.logging.service]

This error seems odd. It suggest that the Pax Logging Service does specify the 
Service PID, but does not implement ManagedService. Will take a closer look 
in the morning.


Cheers
Niclas

_______________________________________________
general mailing list
general@lists.ops4j.org
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to