openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1767573 - in /openwebbeans/microwave/trunk: microwave-arquillian/src/main/java/org/apache/microwave/arquillian/ microwave-core/ microwave-core/src/main/java/org/apache/microwave/ microwave-gradle-plugin/src/main/java/org/apache/microwave/g...
Date Tue, 01 Nov 2016 20:51:03 GMT
Author: rmannibucau
Date: Tue Nov  1 20:51:02 2016
New Revision: 1767573

URL: http://svn.apache.org/viewvc?rev=1767573&view=rev
Log:
jul log4j2 bridge support

Modified:
    openwebbeans/microwave/trunk/microwave-arquillian/src/main/java/org/apache/microwave/arquillian/MicrowaveConfiguration.java
    openwebbeans/microwave/trunk/microwave-core/pom.xml
    openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java
    openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveExtension.java
    openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveTask.java
    openwebbeans/microwave/trunk/microwave-maven-plugin/src/main/java/org/apache/microwave/maven/MicrowaveRunMojo.java

Modified: openwebbeans/microwave/trunk/microwave-arquillian/src/main/java/org/apache/microwave/arquillian/MicrowaveConfiguration.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-arquillian/src/main/java/org/apache/microwave/arquillian/MicrowaveConfiguration.java?rev=1767573&r1=1767572&r2=1767573&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-arquillian/src/main/java/org/apache/microwave/arquillian/MicrowaveConfiguration.java
(original)
+++ openwebbeans/microwave/trunk/microwave-arquillian/src/main/java/org/apache/microwave/arquillian/MicrowaveConfiguration.java
Tue Nov  1 20:51:02 2016
@@ -80,6 +80,7 @@ public class MicrowaveConfiguration impl
     private boolean tomcatWrapLoader = true;
     private String jaxrsDefaultProviders;
     private String sharedLibraries;
+    private boolean useLog4j2JulLogManager = System.getProperty("java.util.logging.manager")
== null;
 
     @Override
     public void validate() throws ConfigurationException {
@@ -539,4 +540,12 @@ public class MicrowaveConfiguration impl
     public void setSharedLibraries(final String sharedLibraries) {
         this.sharedLibraries = sharedLibraries;
     }
+
+    public boolean isUseLog4j2JulLogManager() {
+        return useLog4j2JulLogManager;
+    }
+
+    public void setUseLog4j2JulLogManager(final boolean useLog4j2JulLogManager) {
+        this.useLog4j2JulLogManager = useLog4j2JulLogManager;
+    }
 }

Modified: openwebbeans/microwave/trunk/microwave-core/pom.xml
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/pom.xml?rev=1767573&r1=1767572&r2=1767573&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-core/pom.xml (original)
+++ openwebbeans/microwave/trunk/microwave-core/pom.xml Tue Nov  1 20:51:02 2016
@@ -188,6 +188,11 @@
       <artifactId>log4j-core</artifactId>
       <version>${log4j2.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-jul</artifactId>
+      <version>${log4j2.version}</version>
+    </dependency>
 
     <dependency>
       <groupId>junit</groupId>

Modified: openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java?rev=1767573&r1=1767572&r2=1767573&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java
(original)
+++ openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java
Tue Nov  1 20:51:02 2016
@@ -275,6 +275,9 @@ public class Microwave implements AutoCl
 
     public Microwave start() {
         clearCatalinaSystemProperties = System.getProperty("catalina.base") == null &&
System.getProperty("catalina.home") == null;
+        if (configuration.isUseLog4j2JulLogManager()) {
+            System.setProperty("java.util.logging.manager", "org.apache.logging.log4j.jul.LogManager");
+        }
 
         if (configuration.loggingGlobalSetup) {
             final String[] toRestore = new String[]{
@@ -568,6 +571,9 @@ public class Microwave implements AutoCl
                 if (clearCatalinaSystemProperties) {
                     Stream.of("catalina.base", "catalina.home").forEach(System::clearProperty);
                 }
+                if (configuration.isUseLog4j2JulLogManager()) {
+                    System.clearProperty("java.util.logging.manager");
+                }
                 ofNullable(postTask).ifPresent(Runnable::run);
                 postTask = null;
                 try {
@@ -822,9 +828,12 @@ public class Microwave implements AutoCl
                 "should microwave wrap the loader to define another loader identity but still
use the same classes and resources.")
         private boolean tomcatWrapLoader = false;
 
-        @CliOption(name = "shared-librariries", description = "A folder containing shared
libraries.")
+        @CliOption(name = "shared-librairies", description = "A folder containing shared
libraries.")
         private String sharedLibraries;
 
+        @CliOption(name = "log4j2-jul-bridge", description = "Should JUL logs be redirected
to Log4j2 - only works before JUL usage.")
+        private boolean useLog4j2JulLogManager = System.getProperty("java.util.logging.manager")
== null;
+
         public Builder() { // load defaults
             loadFrom("microwave.properties");
         }
@@ -1281,6 +1290,14 @@ public class Microwave implements AutoCl
             this.jaxrsDefaultProviders = jaxrsDefaultProviders;
         }
 
+        public boolean isUseLog4j2JulLogManager() {
+            return useLog4j2JulLogManager;
+        }
+
+        public void setUseLog4j2JulLogManager(final boolean useLog4j2JulLogManager) {
+            this.useLog4j2JulLogManager = useLog4j2JulLogManager;
+        }
+
         public void loadFromProperties(final Properties config) {
             // filtering properties with system properties or themself
             final StrSubstitutor strSubstitutor = new StrSubstitutor(new StrLookup<String>()
{

Modified: openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveExtension.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveExtension.java?rev=1767573&r1=1767572&r2=1767573&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveExtension.java
(original)
+++ openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveExtension.java
Tue Nov  1 20:51:02 2016
@@ -70,6 +70,15 @@ public class MicrowaveExtension {
     private boolean tomcatWrapLoader = false;
     private String jaxrsDefaultProviders;
     private String sharedLibraries;
+    private boolean useLog4j2JulLogManager = true;
+
+    public boolean isUseLog4j2JulLogManager() {
+        return useLog4j2JulLogManager;
+    }
+
+    public void setUseLog4j2JulLogManager(final boolean useLog4j2JulLogManager) {
+        this.useLog4j2JulLogManager = useLog4j2JulLogManager;
+    }
 
     public String getSharedLibraries() {
         return sharedLibraries;

Modified: openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveTask.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveTask.java?rev=1767573&r1=1767572&r2=1767573&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveTask.java
(original)
+++ openwebbeans/microwave/trunk/microwave-gradle-plugin/src/main/java/org/apache/microwave/gradle/MicrowaveTask.java
Tue Nov  1 20:51:02 2016
@@ -176,6 +176,10 @@ public class MicrowaveTask extends Defau
 
     @Input
     @Optional
+    private boolean useLog4j2JulLogManager = System.getProperty("java.util.logging.manager")
== null;
+
+    @Input
+    @Optional
     private String conf;
 
     @Input
@@ -870,4 +874,12 @@ public class MicrowaveTask extends Defau
     public void setSharedLibraries(final String sharedLibraries) {
         this.sharedLibraries = sharedLibraries;
     }
+
+    public boolean isUseLog4j2JulLogManager() {
+        return useLog4j2JulLogManager;
+    }
+
+    public void setUseLog4j2JulLogManager(final boolean useLog4j2JulLogManager) {
+        this.useLog4j2JulLogManager = useLog4j2JulLogManager;
+    }
 }

Modified: openwebbeans/microwave/trunk/microwave-maven-plugin/src/main/java/org/apache/microwave/maven/MicrowaveRunMojo.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-maven-plugin/src/main/java/org/apache/microwave/maven/MicrowaveRunMojo.java?rev=1767573&r1=1767572&r2=1767573&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-maven-plugin/src/main/java/org/apache/microwave/maven/MicrowaveRunMojo.java
(original)
+++ openwebbeans/microwave/trunk/microwave-maven-plugin/src/main/java/org/apache/microwave/maven/MicrowaveRunMojo.java
Tue Nov  1 20:51:02 2016
@@ -197,6 +197,9 @@ public class MicrowaveRunMojo extends Ab
     @Parameter(property = "microwave.webapp")
     private File webapp;
 
+    @Parameter(property = "microwave.log4j2-jul-bridge", defaultValue = "true")
+    private boolean useLog4j2JulLogManager;
+
     @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
         if (skip) {



Mime
View raw message