Dynamically import LogService and user LogService class name (and not class) to name
the service to enable starting the ConfigurationManager without the LogService.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@571388 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/configadmin/pom.xml b/configadmin/pom.xml
index f088997..a36c24b 100644
--- a/configadmin/pom.xml
+++ b/configadmin/pom.xml
@@ -69,6 +69,9 @@
                         <Bundle-Activator>
                             org.apache.felix.cm.impl.ConfigurationManager
                         </Bundle-Activator>
+                        <DynamicImport-Package>
+                            org.osgi.service.log
+                        </DynamicImport-Package>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java b/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java
index d30b437b..4a44591 100644
--- a/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java
+++ b/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java
@@ -99,6 +99,9 @@
      */
     public static final String CM_CONFIG_DIR = "felix.cm.dir";
 
+    // The name of the LogService (not using the class, which might be missing)
+    private static final String LOG_SERVICE_NAME = "org.osgi.service.log.LogService";
+    
     // random number generator to create configuration PIDs for factory
     // configurations
     private static SecureRandom numberGenerator;
@@ -152,7 +155,7 @@
     public void start( BundleContext bundleContext )
     {
         // track the log service using a ServiceTracker
-        logTracker = new ServiceTracker( bundleContext, LogService.class.getName(), null );
+        logTracker = new ServiceTracker( bundleContext, LOG_SERVICE_NAME , null );
         logTracker.open();
 
         // set up some fields
@@ -205,6 +208,9 @@
         // start handling ManagedService[Factory] services
         managedServiceTracker = new ManagedServiceTracker();
         managedServiceFactoryTracker = new ManagedServiceFactoryTracker();
+        
+        // check logging
+        log(LogService.LOG_ERROR, "CM Started", null);
     }
 
 
@@ -755,10 +761,10 @@
 
     void log( int level, String message, Throwable t )
     {
-        LogService log = ( LogService ) logTracker.getService();
+        Object log = logTracker.getService();
         if ( log != null )
         {
-            log.log( configurationAdminReference, level, message, t );
+            ( ( LogService ) log ).log( configurationAdminReference, level, message, t );
             return;
         }