You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2014/09/05 19:13:46 UTC

[1/4] git commit: Add comment regarding recent OSGi change.

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 2c51cde7c -> aba5c6bbb


Add comment regarding recent OSGi change.


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/42b58740
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/42b58740
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/42b58740

Branch: refs/heads/master
Commit: 42b587402fddf00bd6759b94d6cf76d7676e8141
Parents: 2c51cde
Author: Matt Sicker <ma...@apache.org>
Authored: Fri Sep 5 10:38:41 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Fri Sep 5 10:38:41 2014 -0500

----------------------------------------------------------------------
 log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/42b58740/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java b/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
index b90ab14..c67299c 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
@@ -83,7 +83,8 @@ public class LogManager {
 
         if (factory == null) {
             final SortedMap<Integer, LoggerContextFactory> factories = new TreeMap<Integer, LoggerContextFactory>();
-
+            // note that the following initial call to ProviderUtil may block until a Provider has been installed when
+            // running in an OSGi environment
             if (ProviderUtil.hasProviders()) {
                 for (final Provider provider : ProviderUtil.getProviders()) {
                     final Class<? extends LoggerContextFactory> factoryClass = provider.loadLoggerContextFactory();


[3/4] git commit: Add optional OSGi import for sun.reflect.

Posted by ma...@apache.org.
Add optional OSGi import for sun.reflect.

  - In order to access JDK classes outside java.* in an OSGi environment, they must be exported by the framework.
  - Similar to how LMAX Disruptor has an Import-Package dependency on sun.misc, we have an optional import for sun.reflect.


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/c79d2762
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/c79d2762
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/c79d2762

Branch: refs/heads/master
Commit: c79d276269893841c3aa3da8f2f04f4e43011a69
Parents: 2533c7e
Author: Matt Sicker <ma...@apache.org>
Authored: Fri Sep 5 12:10:35 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Fri Sep 5 12:10:35 2014 -0500

----------------------------------------------------------------------
 log4j-api/pom.xml  | 4 ++++
 log4j-core/pom.xml | 4 ++++
 2 files changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c79d2762/log4j-api/pom.xml
----------------------------------------------------------------------
diff --git a/log4j-api/pom.xml b/log4j-api/pom.xml
index 828a7fb..b087545 100644
--- a/log4j-api/pom.xml
+++ b/log4j-api/pom.xml
@@ -108,6 +108,10 @@
         <configuration>
           <instructions>
             <Export-Package>org.apache.logging.log4j.*</Export-Package>
+            <Import-Package>
+              sun.reflect;resolution:=optional,
+              *
+            </Import-Package>
             <Bundle-Activator>org.apache.logging.log4j.util.Activator</Bundle-Activator>
             <Require-Capability>org.apache.logging.log4j.spi.LoggerContextFactory</Require-Capability>
           </instructions>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c79d2762/log4j-core/pom.xml
----------------------------------------------------------------------
diff --git a/log4j-core/pom.xml b/log4j-core/pom.xml
index 7f02acb..1157c45 100644
--- a/log4j-core/pom.xml
+++ b/log4j-core/pom.xml
@@ -285,6 +285,10 @@
             <Bundle-SymbolicName>org.apache.logging.log4j.core</Bundle-SymbolicName>
             <!-- TODO: exclude internal classes from export -->
             <Export-Package>org.apache.logging.log4j.core.*</Export-Package>
+            <Import-Package>
+              sun.reflect;resolution:=optional,
+              *
+            </Import-Package>
             <Bundle-Activator>org.apache.logging.log4j.core.osgi.Activator</Bundle-Activator>
             <Provide-Capability>org.apache.logging.log4j.spi.LoggerContextFactory</Provide-Capability>
           </instructions>


[4/4] git commit: Remove capability mumbo jumbo.

Posted by ma...@apache.org.
Remove capability mumbo jumbo.

  - Using a lock in log4j-api (ProviderUtil) has prevented the need for this hack in OSGi.


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/aba5c6bb
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/aba5c6bb
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/aba5c6bb

Branch: refs/heads/master
Commit: aba5c6bbbea2e422890964cb1f9f1f2003bd9c3b
Parents: c79d276
Author: Matt Sicker <ma...@apache.org>
Authored: Fri Sep 5 12:13:36 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Fri Sep 5 12:13:36 2014 -0500

----------------------------------------------------------------------
 log4j-api/pom.xml      | 1 -
 log4j-core/pom.xml     | 1 -
 log4j-to-slf4j/pom.xml | 1 -
 3 files changed, 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/aba5c6bb/log4j-api/pom.xml
----------------------------------------------------------------------
diff --git a/log4j-api/pom.xml b/log4j-api/pom.xml
index b087545..e08c82b 100644
--- a/log4j-api/pom.xml
+++ b/log4j-api/pom.xml
@@ -113,7 +113,6 @@
               *
             </Import-Package>
             <Bundle-Activator>org.apache.logging.log4j.util.Activator</Bundle-Activator>
-            <Require-Capability>org.apache.logging.log4j.spi.LoggerContextFactory</Require-Capability>
           </instructions>
         </configuration>
       </plugin>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/aba5c6bb/log4j-core/pom.xml
----------------------------------------------------------------------
diff --git a/log4j-core/pom.xml b/log4j-core/pom.xml
index 1157c45..056d690 100644
--- a/log4j-core/pom.xml
+++ b/log4j-core/pom.xml
@@ -290,7 +290,6 @@
               *
             </Import-Package>
             <Bundle-Activator>org.apache.logging.log4j.core.osgi.Activator</Bundle-Activator>
-            <Provide-Capability>org.apache.logging.log4j.spi.LoggerContextFactory</Provide-Capability>
           </instructions>
         </configuration>
       </plugin>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/aba5c6bb/log4j-to-slf4j/pom.xml
----------------------------------------------------------------------
diff --git a/log4j-to-slf4j/pom.xml b/log4j-to-slf4j/pom.xml
index 656c2d0..128a6d8 100644
--- a/log4j-to-slf4j/pom.xml
+++ b/log4j-to-slf4j/pom.xml
@@ -86,7 +86,6 @@
         <configuration>
           <instructions>
             <Export-Package>org.apache.logging.slf4j</Export-Package>
-            <Provide-Capability>org.apache.logging.log4j.spi.LoggerContextFactory</Provide-Capability>
           </instructions>
         </configuration>
       </plugin>


[2/4] git commit: Remove unused parameters.

Posted by ma...@apache.org.
Remove unused parameters.


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/2533c7ec
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/2533c7ec
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/2533c7ec

Branch: refs/heads/master
Commit: 2533c7ec881feabab823d93ecd9433c011a4e1f2
Parents: 42b5874
Author: Matt Sicker <ma...@apache.org>
Authored: Fri Sep 5 10:44:14 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Fri Sep 5 10:44:14 2014 -0500

----------------------------------------------------------------------
 .../log4j/perf/jmh/ReflectionBenchmark.java     | 21 ++++++++++----------
 1 file changed, 10 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2533c7ec/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/ReflectionBenchmark.java
----------------------------------------------------------------------
diff --git a/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/ReflectionBenchmark.java b/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/ReflectionBenchmark.java
index 3031ffb..3721787 100644
--- a/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/ReflectionBenchmark.java
+++ b/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/ReflectionBenchmark.java
@@ -16,6 +16,10 @@
  */
 package org.apache.logging.log4j.perf.jmh;
 
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Random;
+
 import org.apache.logging.log4j.core.impl.ReflectiveCallerClassUtility;
 import org.apache.logging.log4j.message.Message;
 import org.apache.logging.log4j.message.StringFormattedMessage;
@@ -24,13 +28,8 @@ import org.openjdk.jmh.annotations.Level;
 import org.openjdk.jmh.annotations.Scope;
 import org.openjdk.jmh.annotations.Setup;
 import org.openjdk.jmh.annotations.State;
-import org.openjdk.jmh.logic.BlackHole;
 import sun.reflect.Reflection;
 
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Random;
-
 /**
  * <p>Benchmarks the different ways the caller class can be obtained.
  * To run this in sampling mode (latency test):</p>
@@ -58,21 +57,21 @@ public class ReflectionBenchmark {
     }
 
     @GenerateMicroBenchmark
-    public void testBaseline(final BlackHole bh) {
+    public void testBaseline() {
     }
 
     @GenerateMicroBenchmark
-    public String getCallerClassNameFromStackTrace(final BlackHole bh) {
+    public String getCallerClassNameFromStackTrace() {
         return new Throwable().getStackTrace()[3].getClassName();
     }
 
     @GenerateMicroBenchmark
-    public String getCallerClassNameReflectively(final BlackHole bh) {
+    public String getCallerClassNameReflectively() {
         return ReflectiveCallerClassUtility.getCaller(3).getName();
     }
 
     @GenerateMicroBenchmark
-    public String getCallerClassNameSunReflection(final BlackHole bh) {
+    public String getCallerClassNameSunReflection() {
         return Reflection.getCallerClass(3).getName();
     }
 
@@ -82,12 +81,12 @@ public class ReflectionBenchmark {
     }
 
     @GenerateMicroBenchmark
-    public Class<?> getReflectiveCallerClassUtility(final BlackHole bh) {
+    public Class<?> getReflectiveCallerClassUtility() {
         return ReflectiveCallerClassUtility.getCaller(3);
     }
 
     @GenerateMicroBenchmark
-    public Class<?> getDirectSunReflection(final BlackHole bh) {
+    public Class<?> getDirectSunReflection() {
         return Reflection.getCallerClass(3);
     }