You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2018/04/18 15:53:56 UTC

[sling-ide-tooling] 01/02: SLING-7587 - Create a CLI-only tool to sync content

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch feature/SLING-7587
in repository https://gitbox.apache.org/repos/asf/sling-ide-tooling.git

commit 19f3bab4b94aed5353e30ebd9aee16db0cd1f5f5
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Tue Apr 17 15:09:03 2018 +0300

    SLING-7587 - Create a CLI-only tool to sync content
    
    Make the (eclipse) Tracer a service factory and thus remove the need
    to have custom component and/or registration properties.
---
 eclipse/eclipse-core/META-INF/MANIFEST.MF          |   4 +-
 .../TraceCommandExecutionEventsHandler.xml         |   2 +-
 ...ommandExecutionEventsHandler.xml => Tracer.xml} |  11 +-
 .../eclipse/core/debug/PluginLoggerRegistrar.java  | 131 ---------------------
 .../sling/ide/eclipse/core/debug/impl/Tracer.java  |   7 +-
 .../sling/ide/eclipse/core/internal/Activator.java |  18 +--
 eclipse/eclipse-m2e-ui/META-INF/MANIFEST.MF        |   2 -
 .../sling/ide/eclipse/m2e/internal/Activator.java  |   9 +-
 eclipse/eclipse-sightly-core/META-INF/MANIFEST.MF  |   2 -
 .../ide/eclipse/sightly/internal/Activator.java    |   9 +-
 eclipse/eclipse-ui/META-INF/MANIFEST.MF            |   1 -
 .../sling/ide/eclipse/ui/internal/Activator.java   |   8 +-
 12 files changed, 19 insertions(+), 185 deletions(-)

diff --git a/eclipse/eclipse-core/META-INF/MANIFEST.MF b/eclipse/eclipse-core/META-INF/MANIFEST.MF
index 0d667cd..ef3cc04 100644
--- a/eclipse/eclipse-core/META-INF/MANIFEST.MF
+++ b/eclipse/eclipse-core/META-INF/MANIFEST.MF
@@ -51,11 +51,9 @@ Import-Package: org.apache.commons.httpclient;version="3.1.0",
  org.eclipse.wst.xml.core.internal.validation.eclipse,
  org.osgi.service.component;version="1.1.0"
 Export-Package: org.apache.sling.ide.eclipse.core,
- org.apache.sling.ide.eclipse.core.debug,
  org.apache.sling.ide.eclipse.core.facet,
  org.apache.sling.ide.eclipse.core.internal,
  org.apache.sling.ide.eclipse.core.launch,
  org.apache.sling.ide.eclipse.core.progress,
  org.apache.sling.ide.eclipse.internal.validation;x-friends:="org.apache.sling.ide.eclipse-test"
-Service-Component: OSGI-INF/TraceCommandExecutionEventsHandler.xml
-SlingIDE-PluginLoggerEnabled: true
+Service-Component: OSGI-INF/TraceCommandExecutionEventsHandler.xml, OSGI-INF/Tracer.xml
diff --git a/eclipse/eclipse-core/OSGI-INF/TraceCommandExecutionEventsHandler.xml b/eclipse/eclipse-core/OSGI-INF/TraceCommandExecutionEventsHandler.xml
index be5a82b..6fa7bc3 100644
--- a/eclipse/eclipse-core/OSGI-INF/TraceCommandExecutionEventsHandler.xml
+++ b/eclipse/eclipse-core/OSGI-INF/TraceCommandExecutionEventsHandler.xml
@@ -17,7 +17,7 @@
 -->
 <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">
     <implementation class="org.apache.sling.ide.eclipse.core.debug.impl.TraceCommandExecutionEventsHandler" />
-    <reference bind="bindLogger" cardinality="1..1" interface="org.apache.sling.ide.log.Logger" name="Logger" policy="static" target="(listener.symbolic.name=org.apache.sling.ide.eclipse-core)" unbind="unbindLogger"/>
+    <reference bind="bindLogger" cardinality="1..1" interface="org.apache.sling.ide.log.Logger" name="Logger" policy="static" unbind="unbindLogger"/>
     <service>
         <provide interface="org.osgi.service.event.EventHandler" />
     </service>
diff --git a/eclipse/eclipse-core/OSGI-INF/TraceCommandExecutionEventsHandler.xml b/eclipse/eclipse-core/OSGI-INF/Tracer.xml
similarity index 65%
copy from eclipse/eclipse-core/OSGI-INF/TraceCommandExecutionEventsHandler.xml
copy to eclipse/eclipse-core/OSGI-INF/Tracer.xml
index be5a82b..992b2f3 100644
--- a/eclipse/eclipse-core/OSGI-INF/TraceCommandExecutionEventsHandler.xml
+++ b/eclipse/eclipse-core/OSGI-INF/Tracer.xml
@@ -15,11 +15,10 @@
     See the License for the specific language governing permissions
     and limitations under the License.
 -->
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">
-    <implementation class="org.apache.sling.ide.eclipse.core.debug.impl.TraceCommandExecutionEventsHandler" />
-    <reference bind="bindLogger" cardinality="1..1" interface="org.apache.sling.ide.log.Logger" name="Logger" policy="static" target="(listener.symbolic.name=org.apache.sling.ide.eclipse-core)" unbind="unbindLogger"/>
-    <service>
-        <provide interface="org.osgi.service.event.EventHandler" />
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.2.0">
+    <implementation class="org.apache.sling.ide.eclipse.core.debug.impl.Tracer" />
+    <service servicefactory="true">
+       <provide interface="org.apache.sling.ide.log.Logger"/>
+       <provide interface="org.eclipse.osgi.service.debug.DebugOptionsListener"/>
     </service>
-    <property name="event.topics" value="org/apache/sling/ide/transport" />
 </scr:component>
diff --git a/eclipse/eclipse-core/src/org/apache/sling/ide/eclipse/core/debug/PluginLoggerRegistrar.java b/eclipse/eclipse-core/src/org/apache/sling/ide/eclipse/core/debug/PluginLoggerRegistrar.java
deleted file mode 100644
index d76693a..0000000
--- a/eclipse/eclipse-core/src/org/apache/sling/ide/eclipse/core/debug/PluginLoggerRegistrar.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sling.ide.eclipse.core.debug;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import org.apache.sling.ide.eclipse.core.debug.impl.Tracer;
-import org.apache.sling.ide.log.Logger;
-import org.eclipse.osgi.service.debug.DebugOptions;
-import org.eclipse.osgi.service.debug.DebugOptionsListener;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleListener;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * The <tt>PluginLoggerRegistrar</tt> registers {@link Logger} implementations for use for specific plugins
- * 
- * <p>This implementation acts as an extender, looking for the header {@value #HEADER_NAME_LOGGER_ENABLED} in
- * the bundle's manifest. If presented and with a value of <tt>true</tt>, a <tt>Logger</tt> instance is registered
- * for that bundle.</p>
- * 
- * <p>In turn, <tt>ServiceRegistration</tt> objects can be accessed using the {@link #getServiceRegistration(Bundle)}.
- * This method and the static {@link #getInstance()}} method are present to make it easier to consume in Eclipse
- * plug-ins, where working with declarative services is more complicated.</p>
- *
- */
-public class PluginLoggerRegistrar implements BundleListener {
-    
-    private static final String HEADER_NAME_LOGGER_ENABLED = "SlingIDE-PluginLoggerEnabled";
-    
-    private static final PluginLoggerRegistrar INSTANCE = new PluginLoggerRegistrar();
-    
-    public static PluginLoggerRegistrar getInstance() {
-        return INSTANCE;
-    }
-    
-    private final ConcurrentMap<Long, ServiceRegistration<Logger>> registrations = new ConcurrentHashMap<>();
-    
-    private PluginLoggerRegistrar() {
-        
-    }
-
-    public void init(Bundle[] bundles) {
-        for ( Bundle bundle : bundles )
-            if ( bundle.getState() == Bundle.ACTIVE || bundle.getState() == Bundle.STARTING)
-                registerIfEnabled(bundle);
-    }
-    
-    public void shutdown() {
-        for ( ServiceRegistration<Logger> reg : registrations.values() ) 
-            reg.unregister();
-    }
-    
-    /**
-     * Gets the service registartion of a <tt>Logger</tt> for the specified bundle
-     * 
-     * <p>The client must <b>not</b> call <tt>unregister</tt> on the returned instance, as
-     * it is owned by the <tt>PluginLoggerRegistrar</tt>.</p>
-     * 
-     * @param bundle the bundle to get the service registartion for for
-     * @return the service registration, or <code>null</code> if none was found for this bundle
-     */
-    public ServiceRegistration<Logger> getServiceRegistration(Bundle bundle) {
-        return registrations.get(bundle.getBundleId());
-    }
-    
-    @Override
-    public void bundleChanged(BundleEvent evt) {
-        switch ( evt.getType() ) {
-            case BundleEvent.STARTED:
-                registerIfEnabled(evt.getBundle());
-                break;
-                
-            case BundleEvent.STOPPING:
-                unregister(evt.getBundle());
-                break;
-        }
-    }
-
-    private void unregister(Bundle bundle) {
-        ServiceRegistration<Logger> reg = registrations.remove(bundle.getBundleId());
-        if ( reg != null )
-            reg.unregister();
-        
-    }
-
-    private void registerIfEnabled(final Bundle bundle) {
-        if ( Boolean.parseBoolean(bundle.getHeaders().get(HEADER_NAME_LOGGER_ENABLED)) )
-            registrations.put(bundle.getBundleId(), register(bundle));
-    }
-    
-    /**
-     * Registers a new tracer for the specified bundle
-     * 
-     * @param bundle the bundle to register for
-     * @return the service registration
-     */
-    private ServiceRegistration<Logger> register(Bundle bundle) {
-
-        Dictionary<String, Object> props = new Hashtable<>();
-        props.put(DebugOptions.LISTENER_SYMBOLICNAME, bundle.getSymbolicName());
-        BundleContext ctx = bundle.getBundleContext();
-        
-        // safe to downcast since we are registering the Tracer which implements Logger
-        @SuppressWarnings("unchecked")
-        ServiceRegistration<Logger> serviceRegistration = (ServiceRegistration<Logger>) ctx.registerService(new String[] { DebugOptionsListener.class.getName(), Logger.class.getName() },
-                new Tracer(bundle), props);
-        
-        return serviceRegistration;
-    }
-    
-}
diff --git a/eclipse/eclipse-core/src/org/apache/sling/ide/eclipse/core/debug/impl/Tracer.java b/eclipse/eclipse-core/src/org/apache/sling/ide/eclipse/core/debug/impl/Tracer.java
index cea6f88..60a255d 100644
--- a/eclipse/eclipse-core/src/org/apache/sling/ide/eclipse/core/debug/impl/Tracer.java
+++ b/eclipse/eclipse-core/src/org/apache/sling/ide/eclipse/core/debug/impl/Tracer.java
@@ -27,6 +27,7 @@ import org.eclipse.osgi.service.debug.DebugOptionsListener;
 import org.eclipse.osgi.service.debug.DebugTrace;
 import org.eclipse.osgi.util.NLS;
 import org.osgi.framework.Bundle;
+import org.osgi.service.component.ComponentContext;
 
 /**
  * The <tt>Tracer</tt> is the default implementation of the <tt>Logger</tt>
@@ -35,14 +36,14 @@ public class Tracer implements DebugOptionsListener, Logger {
 
     private static final long PERF_IGNORE_THRESHOLD = 50;
 
-    private final Bundle bundle;
+    private Bundle bundle;
     private boolean debugEnabled;
     private boolean consoleEnabled;
     private boolean performanceEnabled;
     private DebugTrace trace;
     
-    public Tracer(Bundle bundle) {
-        this.bundle = bundle;
+    protected void activate(ComponentContext ctx) {
+        bundle = ctx.getUsingBundle();
     }
 
     @Override
diff --git a/eclipse/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java b/eclipse/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java
index 48e8ca8..05b809f 100644
--- a/eclipse/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java
+++ b/eclipse/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java
@@ -22,7 +22,6 @@ import java.util.Map;
 import org.apache.sling.ide.artifacts.EmbeddedArtifactLocator;
 import org.apache.sling.ide.eclipse.core.Preferences;
 import org.apache.sling.ide.eclipse.core.ServiceUtil;
-import org.apache.sling.ide.eclipse.core.debug.PluginLoggerRegistrar;
 import org.apache.sling.ide.eclipse.core.launch.SourceReferenceResolver;
 import org.apache.sling.ide.filter.FilterLocator;
 import org.apache.sling.ide.log.Logger;
@@ -34,7 +33,6 @@ import org.apache.sling.ide.transport.CommandExecutionProperties;
 import org.apache.sling.ide.transport.RepositoryFactory;
 import org.eclipse.core.runtime.Plugin;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.event.Event;
 import org.osgi.service.event.EventAdmin;
 import org.osgi.util.tracker.ServiceTracker;
@@ -66,21 +64,12 @@ public class Activator extends Plugin {
     private ServiceTracker<SourceReferenceResolver, Object> sourceReferenceLocator;
     private ServiceTracker<SyncCommandFactory, SyncCommandFactory> commandFactory;
     
-    private ServiceRegistration<Logger> tracerRegistration;
-
     private Preferences preferences;
 
 	public void start(BundleContext context) throws Exception {
 		super.start(context);
 		plugin = this;
 		
-		PluginLoggerRegistrar loggerRegistrar = PluginLoggerRegistrar.getInstance();
-		
-        loggerRegistrar.init(context.getBundles());
-        context.addBundleListener(loggerRegistrar);
-
-        tracerRegistration = loggerRegistrar.getServiceRegistration(context.getBundle());
-
         eventAdmin = new ServiceTracker<>(context, EventAdmin.class, null);
         eventAdmin.open();
 
@@ -101,7 +90,7 @@ public class Activator extends Plugin {
         artifactLocator = new ServiceTracker<>(context, EmbeddedArtifactLocator.class, null);
         artifactLocator.open();
 
-        tracer = new ServiceTracker<>(context, tracerRegistration.getReference(), null);
+        tracer = new ServiceTracker<>(context, Logger.class, null);
         tracer.open();
         
         batcherFactoryLocator = new ServiceTracker<>(context, BatcherFactory.class, null);
@@ -120,11 +109,6 @@ public class Activator extends Plugin {
 	 */
 	public void stop(BundleContext context) throws Exception {
 	    
-	    PluginLoggerRegistrar loggerRegistrar = PluginLoggerRegistrar.getInstance();
-	    
-	    context.removeBundleListener(loggerRegistrar);
-	    loggerRegistrar.shutdown();
-
         repositoryFactory.close();
         serializationManager.close();
         filterLocator.close();
diff --git a/eclipse/eclipse-m2e-ui/META-INF/MANIFEST.MF b/eclipse/eclipse-m2e-ui/META-INF/MANIFEST.MF
index 1480c68..6976b45 100644
--- a/eclipse/eclipse-m2e-ui/META-INF/MANIFEST.MF
+++ b/eclipse/eclipse-m2e-ui/META-INF/MANIFEST.MF
@@ -21,7 +21,6 @@ Import-Package: org.apache.commons.httpclient;version="3.1.0",
  org.apache.commons.lang,
  org.apache.sling.ide.artifacts,
  org.apache.sling.ide.eclipse.core,
- org.apache.sling.ide.eclipse.core.debug,
  org.apache.sling.ide.eclipse.core.progress,
  org.apache.sling.ide.eclipse.ui,
  org.apache.sling.ide.eclipse.ui.wizards,
@@ -67,4 +66,3 @@ Import-Package: org.apache.commons.httpclient;version="3.1.0",
  org.osgi.util.tracker;version="1.5.0"
 Bundle-ActivationPolicy: lazy
 Export-Package: org.apache.sling.ide.eclipse.ui.wizards.np
-SlingIDE-PluginLoggerEnabled: true
diff --git a/eclipse/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/Activator.java b/eclipse/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/Activator.java
index 5720e10..b41cfa8 100644
--- a/eclipse/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/Activator.java
+++ b/eclipse/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/Activator.java
@@ -18,7 +18,6 @@ package org.apache.sling.ide.eclipse.m2e.internal;
 
 import org.apache.sling.ide.artifacts.EmbeddedArtifactLocator;
 import org.apache.sling.ide.eclipse.core.ServiceUtil;
-import org.apache.sling.ide.eclipse.core.debug.PluginLoggerRegistrar;
 import org.apache.sling.ide.log.Logger;
 import org.apache.sling.ide.osgi.OsgiClientFactory;
 import org.eclipse.core.runtime.Plugin;
@@ -26,7 +25,6 @@ import org.eclipse.core.runtime.preferences.InstanceScope;
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.ui.preferences.ScopedPreferenceStore;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
 import org.osgi.util.tracker.ServiceTracker;
 
 public class Activator extends Plugin {
@@ -36,8 +34,6 @@ public class Activator extends Plugin {
 
     private ServiceTracker<EmbeddedArtifactLocator, EmbeddedArtifactLocator> artifactLocator;
     private ServiceTracker<OsgiClientFactory, OsgiClientFactory> osgiClientFactory;
-
-    private ServiceRegistration<Logger> tracerRegistration;
     private ServiceTracker<Logger, Logger> tracer;
 
     /**
@@ -62,9 +58,7 @@ public class Activator extends Plugin {
                 null);
         osgiClientFactory.open();
 
-        tracerRegistration = PluginLoggerRegistrar.getInstance().getServiceRegistration(context.getBundle());
-
-        tracer = new ServiceTracker<>(context, tracerRegistration.getReference(), null);
+        tracer = new ServiceTracker<>(context, Logger.class, null);
         tracer.open();
     }
 
@@ -73,6 +67,7 @@ public class Activator extends Plugin {
         INSTANCE = null;
 
         artifactLocator.close();
+        tracer.close();
 
         super.stop(context);
     }
diff --git a/eclipse/eclipse-sightly-core/META-INF/MANIFEST.MF b/eclipse/eclipse-sightly-core/META-INF/MANIFEST.MF
index 176e644..6a61580 100644
--- a/eclipse/eclipse-sightly-core/META-INF/MANIFEST.MF
+++ b/eclipse/eclipse-sightly-core/META-INF/MANIFEST.MF
@@ -12,7 +12,6 @@ Require-Bundle: org.eclipse.core.runtime,
  org.eclipse.swt,
  org.eclipse.osgi
 Import-Package: org.apache.sling.ide.eclipse.core,
- org.apache.sling.ide.eclipse.core.debug,
  org.apache.sling.ide.eclipse.core.facet,
  org.apache.sling.ide.log,
  org.eclipse.core.expressions,
@@ -37,4 +36,3 @@ Export-Package: org.apache.sling.ide.eclipse.sightly,
  org.apache.sling.ide.eclipse.sightly.model,
  org.apache.sling.ide.eclipse.sightly.validation,
  org.apache.sling.ide.eclipse.sightly.internal;x-friends:="org.apache.sling.ide.eclipse-test"
-SlingIDE-PluginLoggerEnabled: true
diff --git a/eclipse/eclipse-sightly-core/src/org/apache/sling/ide/eclipse/sightly/internal/Activator.java b/eclipse/eclipse-sightly-core/src/org/apache/sling/ide/eclipse/sightly/internal/Activator.java
index 31cadd0..74d8a79 100644
--- a/eclipse/eclipse-sightly-core/src/org/apache/sling/ide/eclipse/sightly/internal/Activator.java
+++ b/eclipse/eclipse-sightly-core/src/org/apache/sling/ide/eclipse/sightly/internal/Activator.java
@@ -18,10 +18,8 @@ package org.apache.sling.ide.eclipse.sightly.internal;
 
 import org.apache.sling.ide.log.Logger;
 import org.apache.sling.ide.eclipse.core.ServiceUtil;
-import org.apache.sling.ide.eclipse.core.debug.PluginLoggerRegistrar;
 import org.eclipse.core.runtime.Plugin;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
 import org.osgi.util.tracker.ServiceTracker;
 
 public class Activator extends Plugin {
@@ -32,15 +30,12 @@ public class Activator extends Plugin {
     // The shared instance
     private static Activator plugin;
 
-    private ServiceRegistration<Logger> loggerRegistration;
-
     private ServiceTracker<Logger, Logger> loggerTracker;
 
 
     public void start(BundleContext context) throws Exception {
         
-        loggerRegistration = PluginLoggerRegistrar.getInstance().getServiceRegistration(context.getBundle());
-        loggerTracker = new ServiceTracker<>(context, loggerRegistration.getReference(), null);
+        loggerTracker = new ServiceTracker<>(context, Logger.class, null);
         loggerTracker.open();
         
         super.start(context);
@@ -55,6 +50,8 @@ public class Activator extends Plugin {
 
         plugin = null;
         
+        loggerTracker.close();
+        
         super.stop(context);
     }
 
diff --git a/eclipse/eclipse-ui/META-INF/MANIFEST.MF b/eclipse/eclipse-ui/META-INF/MANIFEST.MF
index b96203a..88bae5c 100644
--- a/eclipse/eclipse-ui/META-INF/MANIFEST.MF
+++ b/eclipse/eclipse-ui/META-INF/MANIFEST.MF
@@ -102,4 +102,3 @@ Export-Package: org.apache.sling.ide.eclipse.ui,
  org.apache.sling.ide.eclipse.ui.propertyPages,
  org.apache.sling.ide.eclipse.ui.views,
  org.apache.sling.ide.eclipse.ui.wizards
-SlingIDE-PluginLoggerEnabled: true
diff --git a/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/Activator.java b/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/Activator.java
index 0e56bdd..0fdec2d 100644
--- a/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/Activator.java
+++ b/eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/Activator.java
@@ -19,7 +19,6 @@ package org.apache.sling.ide.eclipse.ui.internal;
 import org.apache.sling.ide.artifacts.EmbeddedArtifactLocator;
 import org.apache.sling.ide.eclipse.core.Preferences;
 import org.apache.sling.ide.eclipse.core.ServiceUtil;
-import org.apache.sling.ide.eclipse.core.debug.PluginLoggerRegistrar;
 import org.apache.sling.ide.filter.FilterLocator;
 import org.apache.sling.ide.log.Logger;
 import org.apache.sling.ide.osgi.OsgiClientFactory;
@@ -30,7 +29,6 @@ import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.eclipse.ui.preferences.ScopedPreferenceStore;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.event.EventAdmin;
 import org.osgi.util.tracker.ServiceTracker;
 
@@ -47,7 +45,6 @@ public class Activator extends AbstractUIPlugin {
     private ServiceTracker<Logger, Logger> tracer;
     private ServiceTracker<SyncCommandFactory, SyncCommandFactory> commandFactory;
     
-    private ServiceRegistration<Logger> tracerRegistration;
     private ScopedPreferenceStore preferenceStore;
     
     private Preferences preferences;
@@ -61,8 +58,6 @@ public class Activator extends AbstractUIPlugin {
     public void start(BundleContext context) throws Exception {
         super.start(context);
 
-        tracerRegistration = PluginLoggerRegistrar.getInstance().getServiceRegistration(context.getBundle());
-
         serializationManager = new ServiceTracker<>(context, SerializationManager.class, null);
         serializationManager.open();
 
@@ -80,7 +75,7 @@ public class Activator extends AbstractUIPlugin {
                 null);
         osgiClientFactory.open();
 
-        tracer = new ServiceTracker<>(context, tracerRegistration.getReference(), null);
+        tracer = new ServiceTracker<>(context, Logger.class, null);
         tracer.open();
         
         commandFactory = new ServiceTracker<>(context, SyncCommandFactory.class, null);
@@ -98,6 +93,7 @@ public class Activator extends AbstractUIPlugin {
         artifactLocator.close();
         osgiClientFactory.close();
         commandFactory.close();
+        tracer.close();
 
         super.stop(context);
     }

-- 
To stop receiving notification emails like this one, please contact
rombert@apache.org.