private void removeLogger()

in src/main/java/org/apache/sling/commons/log/logback/internal/SlingLogPanel.java [675:705]


    private void removeLogger(final String pid) throws ConfigurationException {
        // try to get the configadmin service reference
        ServiceReference<ConfigurationAdmin> sr = this.bundleContext.getServiceReference(ConfigurationAdmin.class);
        if (sr != null) {
            ConfigurationAdmin configAdmin = null;
            try {
                if (pid == null) {
                    throw new ConfigurationException(LogConstants.PID, "PID has to be specified.");
                }
                // try to get the configadmin
                configAdmin = this.bundleContext.getService(sr);
                if (configAdmin != null) {
                    try {
                        Configuration config = configAdmin.getConfiguration(pid);
                        if (config != null) {
                            config.delete();
                        } else {
                            throw new ConfigurationException(LogConstants.PID, "No configuration for this PID: " + pid);
                        }
                    } catch (IOException ioe) {
                        internalFailure("Cannot delete configuration for pid " + pid, ioe);
                    }
                }
            } finally {
                if (configAdmin != null) {
                    // release the configadmin reference
                    this.bundleContext.ungetService(sr);
                }
            }
        }
    }