You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2011/10/02 15:39:56 UTC
svn commit: r1178189 - in /sling/trunk/bundles/commons/log: ./
src/main/java/org/apache/sling/commons/log/internal/
Author: fmeschbe
Date: Sun Oct 2 13:39:56 2011
New Revision: 1178189
URL: http://svn.apache.org/viewvc?rev=1178189&view=rev
Log:
SLIGN-2224 Factor OSGi LogService implementation out into a separate bundle and don't embedd SLF4J API, logf4-over-slf4j, and jcl-over-slf4j any longer. Reflect this change in the Bundle Name (the symbolic name is still the same).
Removed:
sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/LogEntryImpl.java
sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/LogReaderServiceFactory.java
sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/LogServiceFactory.java
sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/LogSupport.java
Modified:
sling/trunk/bundles/commons/log/README.txt
sling/trunk/bundles/commons/log/pom.xml
sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/Activator.java
sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/LogManager.java
Modified: sling/trunk/bundles/commons/log/README.txt
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/log/README.txt?rev=1178189&r1=1178188&r2=1178189&view=diff
==============================================================================
--- sling/trunk/bundles/commons/log/README.txt (original)
+++ sling/trunk/bundles/commons/log/README.txt Sun Oct 2 13:39:56 2011
@@ -1,21 +1,13 @@
-Apache Sling OSGi LogService Implementation
+Apache Sling SLF4J Implementation
-=================================================
-Welcome to Sling - OSGi LogService Implementation
-=================================================
-
-The "log" project defines an OSGi Bundle (Logging) which provides three
-components:
-
- (1) An implementation of the Log Service Specification contained in
- the OSGi Service Platform Service Compendium book.
-
- (2) The SLF4J API package (org.slfj), Apache Commons Logging API
- package (org.apache.commons.logging) and Log4J package
- (org.apache.log4j) for clients to use.
-
- (3) Backend logging implementation of the SLF4J interfaces.
+=======================================
+Welcome to Sling - SLF4J Implementation
+=======================================
+
+The "log" project implements the SLF4J SPI and thus operates as the backend
+for the SLF4J API. The SLF4j API bundle must be installed along with this
+bundle to provide full SLF4J logging support.
The Logging bundle should be installed as one of the first modules in
the OSGi framework and - provided the framework supports start levels -
Modified: sling/trunk/bundles/commons/log/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/log/pom.xml?rev=1178189&r1=1178188&r2=1178189&view=diff
==============================================================================
--- sling/trunk/bundles/commons/log/pom.xml (original)
+++ sling/trunk/bundles/commons/log/pom.xml Sun Oct 2 13:39:56 2011
@@ -31,12 +31,10 @@
<version>2.1.3-SNAPSHOT</version>
<packaging>bundle</packaging>
- <name>Apache Sling OSGi LogService Implementation</name>
+ <name>Apache Sling SLF4J Implementation</name>
<description>
- Implementation of the OSGi Compendium Log Service using SLF4J
- on top of a private implementation. In addition to providing the
- implemented SLF4J API, the Log4J and Jakarta Commons Logging APIs
- are provided with implementations on top of the SLF4J API.
+ This bundle implements the SLF4J API with support for dynamic
+ configuration through OSGi Configuration Admin Service.
</description>
<scm>
@@ -64,23 +62,16 @@
http://sling.apache.org/site/logging.html
</Bundle-DocURL>
<Export-Package>
- org.apache.commons.logging;version=1.1.1,
- org.apache.log4j;version=1.2.16,
- org.slf4j;version=${slf4j.version},
- org.osgi.service.log
+ org.slf4j.impl;version=${slf4j.version}
</Export-Package>
<Private-Package>
org.apache.sling.commons.log.*,
- org.apache.commons.logging.impl,
- org.slf4j.impl,
- org.slf4j.helpers,org.slf4j.spi
</Private-Package>
<Import-Package>
+ !org.slf4j.impl,
javax.servlet.*;resolution:=optional,
org.osgi.framework;version=1.3,
- org.slf4j;org.osgi.service.log;version="[$(version;==;$(@)),$(version;=+;$(@)))",
- !org.apache.commons.logging,
- !org.apache.log4j,
+ org.slf4j;version="[$(version;==;$(@)),$(version;=+;$(@)))",
*
</Import-Package>
<DynamicImport-Package>
@@ -109,27 +100,11 @@
</reporting>
<dependencies>
- <!-- Redirection of commons logging and log4j to SLF4J -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- <version>${slf4j.version}</version>
- <scope>compile</scope>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>log4j-over-slf4j</artifactId>
- <version>${slf4j.version}</version>
- <scope>compile</scope>
- <optional>true</optional>
- </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
- <scope>compile</scope>
- <optional>true</optional>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
@@ -143,18 +118,19 @@
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
+ <version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
- <scope>compile</scope>
- <optional>true</optional>
+ <version>4.0.0</version>
</dependency>
<!-- servlet API for the web console plugin -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
+ <version>2.3</version>
</dependency>
<!-- OSGi Command Line Shell support -->
Modified: sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/Activator.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/Activator.java?rev=1178189&r1=1178188&r2=1178189&view=diff
==============================================================================
--- sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/Activator.java (original)
+++ sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/Activator.java Sun Oct 2 13:39:56 2011
@@ -16,14 +16,8 @@
*/
package org.apache.sling.commons.log.internal;
-import java.util.Dictionary;
-import java.util.Hashtable;
-
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.service.log.LogReaderService;
-import org.osgi.service.log.LogService;
import org.slf4j.bridge.SLF4JBridgeHandler;
/**
@@ -34,41 +28,16 @@ import org.slf4j.bridge.SLF4JBridgeHandl
*/
public class Activator implements BundleActivator {
- private static final String VENDOR = "The Apache Software Foundation";
-
private static final String JUL_SUPPORT = "org.apache.sling.commons.log.julenabled";
private LogManager logManager;
- private LogSupport logSupport;
-
/**
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(final BundleContext context) throws Exception {
logManager = new LogManager(context);
- logSupport = new LogSupport();
- context.addBundleListener(logSupport);
- context.addFrameworkListener(logSupport);
- context.addServiceListener(logSupport);
-
- LogServiceFactory lsf = new LogServiceFactory(logSupport);
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put(Constants.SERVICE_PID, lsf.getClass().getName());
- props.put(Constants.SERVICE_DESCRIPTION,
- "Apache Sling LogService implementation");
- props.put(Constants.SERVICE_VENDOR, VENDOR);
- context.registerService(LogService.class.getName(), lsf, props);
-
- LogReaderServiceFactory lrsf = new LogReaderServiceFactory(logSupport);
- props = new Hashtable<String, String>();
- props.put(Constants.SERVICE_PID, lrsf.getClass().getName());
- props.put(Constants.SERVICE_DESCRIPTION,
- "Apache Sling LogReaderService implementation");
- props.put(Constants.SERVICE_VENDOR, VENDOR);
- context.registerService(LogReaderService.class.getName(), lrsf, props);
-
if (Boolean.parseBoolean(context.getProperty(JUL_SUPPORT))) {
SLF4JBridgeHandler.install();
}
@@ -80,14 +49,6 @@ public class Activator implements Bundle
public void stop(final BundleContext context) throws Exception {
SLF4JBridgeHandler.uninstall();
- if (logSupport != null) {
- context.removeBundleListener(logSupport);
- context.removeFrameworkListener(logSupport);
- context.removeServiceListener(logSupport);
- logSupport.shutdown();
- logSupport = null;
- }
-
if (logManager != null) {
logManager.shutdown();
logManager = null;
Modified: sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/LogManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/LogManager.java?rev=1178189&r1=1178188&r2=1178189&view=diff
==============================================================================
--- sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/LogManager.java (original)
+++ sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/LogManager.java Sun Oct 2 13:39:56 2011
@@ -82,7 +82,7 @@ public class LogManager {
logConfigManager.setDefaultConfiguration(getBundleConfiguration(context));
// get our own logger
- log = LoggerFactory.getLogger(LogServiceFactory.class);
+ log = LoggerFactory.getLogger(LogManager.class);
log.info("LogManager: Logging set up from context");
// prepare registration properties (will be reused)