incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r1169918 - in /sling/trunk: bundles/commons/log/ bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/ launchpad/builder/src/main/bundles/ launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/serv...
Date Mon, 12 Sep 2011 20:52:19 GMT
Author: justin
Date: Mon Sep 12 20:52:18 2011
New Revision: 1169918

URL: http://svn.apache.org/viewvc?rev=1169918&view=rev
Log:
SLING-2193 - adding JUL support (optionally if framework property org.apache.sling.commons.log.julenabled
is "true")

Modified:
    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/launchpad/builder/src/main/bundles/list.xml
    sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/TestServlet.java
    sling/trunk/launchpad/testing/src/test/config/sling.properties

Modified: sling/trunk/bundles/commons/log/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/log/pom.xml?rev=1169918&r1=1169917&r2=1169918&view=diff
==============================================================================
--- sling/trunk/bundles/commons/log/pom.xml (original)
+++ sling/trunk/bundles/commons/log/pom.xml Mon Sep 12 20:52:18 2011
@@ -86,6 +86,9 @@
                         <DynamicImport-Package>
                             org.osgi.service.cm;version=1.2
                         </DynamicImport-Package>
+                        <Embed-Dependency>
+                            jul-to-slf4j;inline="org/slf4j/bridge/SLF4JBridgeHandler.class"
+                        </Embed-Dependency>
                     </instructions>
                 </configuration>
             </plugin>
@@ -128,6 +131,13 @@
             <scope>compile</scope>
             <optional>true</optional>
         </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>jul-to-slf4j</artifactId>
+            <version>${slf4j.version}</version>
+            <scope>compile</scope>
+            <optional>true</optional>
+        </dependency>
 
         <!-- OSGi Libraries not included here -->
         <dependency>

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=1169918&r1=1169917&r2=1169918&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
Mon Sep 12 20:52:18 2011
@@ -24,6 +24,7 @@ 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;
 
 /**
  * The <code>Activator</code> class is the <code>BundleActivator</code>
for
@@ -35,6 +36,8 @@ public class Activator implements Bundle
 
     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;
@@ -65,12 +68,18 @@ public class Activator implements Bundle
             "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();
+        }
     }
 
     /**
      * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
      */
     public void stop(final BundleContext context) throws Exception {
+        SLF4JBridgeHandler.uninstall();
+
         if (logSupport != null) {
             context.removeBundleListener(logSupport);
             context.removeFrameworkListener(logSupport);

Modified: sling/trunk/launchpad/builder/src/main/bundles/list.xml
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/builder/src/main/bundles/list.xml?rev=1169918&r1=1169917&r2=1169918&view=diff
==============================================================================
--- sling/trunk/launchpad/builder/src/main/bundles/list.xml (original)
+++ sling/trunk/launchpad/builder/src/main/bundles/list.xml Mon Sep 12 20:52:18 2011
@@ -240,7 +240,7 @@
         <bundle>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.commons.log</artifactId>
-            <version>2.1.2</version>
+            <version>2.1.3-SNAPSHOT</version>
         </bundle>
         <bundle>
             <groupId>org.apache.sling</groupId>

Modified: sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/TestServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/TestServlet.java?rev=1169918&r1=1169917&r2=1169918&view=diff
==============================================================================
--- sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/TestServlet.java
(original)
+++ sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/servlets/TestServlet.java
Mon Sep 12 20:52:18 2011
@@ -19,6 +19,8 @@ package org.apache.sling.launchpad.tests
 import java.io.IOException;
 import java.util.Date;
 import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import javax.servlet.ServletException;
 
@@ -36,6 +38,7 @@ class TestServlet extends SlingAllMethod
   @Override
   protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response)

   throws ServletException, IOException {
+    Logger.getLogger(TestServlet.class.getName()).log(Level.SEVERE, "test JUL message");
     dumpRequestAsProperties(request, response);
   }
   

Modified: sling/trunk/launchpad/testing/src/test/config/sling.properties
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/test/config/sling.properties?rev=1169918&r1=1169917&r2=1169918&view=diff
==============================================================================
--- sling/trunk/launchpad/testing/src/test/config/sling.properties (original)
+++ sling/trunk/launchpad/testing/src/test/config/sling.properties Mon Sep 12 20:52:18 2011
@@ -14,4 +14,5 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-sling.system.packages.class.com.vladium.emma.rt.RT=com.vladium.emma.rt
\ No newline at end of file
+sling.system.packages.class.com.vladium.emma.rt.RT=com.vladium.emma.rt
+org.apache.sling.commons.log.julenabled=true
\ No newline at end of file



Mime
View raw message