openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1779825 - in /openwebbeans/meecrowave/trunk: meecrowave-arquillian/src/main/java/org/apache/meecrowave/arquillian/ meecrowave-core/src/main/java/org/apache/meecrowave/ meecrowave-core/src/main/java/org/apache/meecrowave/tomcat/ meecrowave-...
Date Sun, 22 Jan 2017 15:13:03 GMT
Author: rmannibucau
Date: Sun Jan 22 15:13:03 2017
New Revision: 1779825

URL: http://svn.apache.org/viewvc?rev=1779825&view=rev
Log:
MEECROWAVE-9 access log option

Added:
    openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/tomcat/LoggingAccessLogPattern.java
Modified:
    openwebbeans/meecrowave/trunk/meecrowave-arquillian/src/main/java/org/apache/meecrowave/arquillian/MeecrowaveConfiguration.java
    openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java
    openwebbeans/meecrowave/trunk/meecrowave-gradle-plugin/src/main/java/org/apache/meecrowave/gradle/MeecrowaveExtension.java
    openwebbeans/meecrowave/trunk/meecrowave-gradle-plugin/src/main/java/org/apache/meecrowave/gradle/MeecrowaveTask.java
    openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/java/org/apache/meecrowave/maven/MeecrowaveRunMojo.java

Modified: openwebbeans/meecrowave/trunk/meecrowave-arquillian/src/main/java/org/apache/meecrowave/arquillian/MeecrowaveConfiguration.java
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-arquillian/src/main/java/org/apache/meecrowave/arquillian/MeecrowaveConfiguration.java?rev=1779825&r1=1779824&r2=1779825&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-arquillian/src/main/java/org/apache/meecrowave/arquillian/MeecrowaveConfiguration.java
(original)
+++ openwebbeans/meecrowave/trunk/meecrowave-arquillian/src/main/java/org/apache/meecrowave/arquillian/MeecrowaveConfiguration.java
Sun Jan 22 15:13:03 2017
@@ -101,6 +101,7 @@ public class MeecrowaveConfiguration imp
     private String scanningPackageExcludes;
     private boolean tomcatNoJmx = true;
     private boolean injectServletContainerInitializer = true;
+    private String tomcatAccessLogPattern;
 
     @Override
     public void validate() throws ConfigurationException {
@@ -728,4 +729,12 @@ public class MeecrowaveConfiguration imp
     public void setInjectServletContainerInitializer(final boolean injectServletContainerInitializer)
{
         this.injectServletContainerInitializer = injectServletContainerInitializer;
     }
+
+    public String getTomcatAccessLogPattern() {
+        return tomcatAccessLogPattern;
+    }
+
+    public void setTomcatAccessLogPattern(final String tomcatAccessLogPattern) {
+        this.tomcatAccessLogPattern = tomcatAccessLogPattern;
+    }
 }

Modified: openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java?rev=1779825&r1=1779824&r2=1779825&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java
(original)
+++ openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java
Sun Jan 22 15:13:03 2017
@@ -48,6 +48,7 @@ import org.apache.meecrowave.logging.tom
 import org.apache.meecrowave.openwebbeans.OWBAutoSetup;
 import org.apache.meecrowave.runner.cli.CliOption;
 import org.apache.meecrowave.tomcat.CDIInstanceManager;
+import org.apache.meecrowave.tomcat.LoggingAccessLogPattern;
 import org.apache.meecrowave.tomcat.NoDescriptorRegistry;
 import org.apache.meecrowave.tomcat.OWBJarScanner;
 import org.apache.meecrowave.tomcat.ProvidedLoader;
@@ -489,6 +490,8 @@ public class Meecrowave implements AutoC
             tomcat.setHost(host);
         }
 
+        ofNullable(configuration.getTomcatAccessLogPattern()).ifPresent(pattern -> tomcat.getHost().getPipeline().addValve(new
LoggingAccessLogPattern(pattern)));
+
         if (configuration.realm != null) {
             tomcat.getEngine().setRealm(configuration.realm);
         }
@@ -996,6 +999,11 @@ public class Meecrowave implements AutoC
         @CliOption(name = "servlet-container-initializer-injection", description = "Should
ServletContainerInitialize support injections.")
         private boolean injectServletContainerInitializer = true;
 
+        @CliOption(
+                name = "tomcat-access-log-pattern",
+                description = "Activates and configure the access log valve. Value example:
'%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\"'")
+        private String tomcatAccessLogPattern;
+
         private final Map<Class<?>, Object> extensions = new HashMap<>();
 
         public Builder() { // load defaults
@@ -1014,6 +1022,14 @@ public class Meecrowave implements AutoC
             }));
         }
 
+        public String getTomcatAccessLogPattern() {
+            return tomcatAccessLogPattern;
+        }
+
+        public void setTomcatAccessLogPattern(final String tomcatAccessLogPattern) {
+            this.tomcatAccessLogPattern = tomcatAccessLogPattern;
+        }
+
         public boolean isTomcatNoJmx() {
             return tomcatNoJmx;
         }

Added: openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/tomcat/LoggingAccessLogPattern.java
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/tomcat/LoggingAccessLogPattern.java?rev=1779825&view=auto
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/tomcat/LoggingAccessLogPattern.java
(added)
+++ openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/tomcat/LoggingAccessLogPattern.java
Sun Jan 22 15:13:03 2017
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.meecrowave.tomcat;
+
+import org.apache.catalina.valves.AbstractAccessLogValve;
+import org.apache.meecrowave.logging.tomcat.LogFacade;
+
+import java.io.CharArrayWriter;
+
+public class LoggingAccessLogPattern extends AbstractAccessLogValve {
+    private final LogFacade logger;
+
+    public LoggingAccessLogPattern(final String pattern) {
+        logger = new LogFacade(LoggingAccessLogPattern.class.getName());
+        setAsyncSupported(true);
+        setPattern(pattern);
+    }
+
+    @Override
+    protected void log(final CharArrayWriter message) {
+        logger.info(message);
+    }
+}

Modified: openwebbeans/meecrowave/trunk/meecrowave-gradle-plugin/src/main/java/org/apache/meecrowave/gradle/MeecrowaveExtension.java
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-gradle-plugin/src/main/java/org/apache/meecrowave/gradle/MeecrowaveExtension.java?rev=1779825&r1=1779824&r2=1779825&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-gradle-plugin/src/main/java/org/apache/meecrowave/gradle/MeecrowaveExtension.java
(original)
+++ openwebbeans/meecrowave/trunk/meecrowave-gradle-plugin/src/main/java/org/apache/meecrowave/gradle/MeecrowaveExtension.java
Sun Jan 22 15:13:03 2017
@@ -91,6 +91,7 @@ public class MeecrowaveExtension {
     private String scanningPackageExcludes;
     private boolean tomcatNoJmx = true;
     private boolean injectServletContainerInitializer = true;
+    private String tomcatAccessLogPattern;
 
     public boolean isJava9SkipWorkarounds() {
         return java9SkipWorkarounds;
@@ -619,4 +620,12 @@ public class MeecrowaveExtension {
     public void setInjectServletContainerInitializer(final boolean injectServletContainerInitializer)
{
         this.injectServletContainerInitializer = injectServletContainerInitializer;
     }
+
+    public String getTomcatAccessLogPattern() {
+        return tomcatAccessLogPattern;
+    }
+
+    public void setTomcatAccessLogPattern(final String tomcatAccessLogPattern) {
+        this.tomcatAccessLogPattern = tomcatAccessLogPattern;
+    }
 }

Modified: openwebbeans/meecrowave/trunk/meecrowave-gradle-plugin/src/main/java/org/apache/meecrowave/gradle/MeecrowaveTask.java
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-gradle-plugin/src/main/java/org/apache/meecrowave/gradle/MeecrowaveTask.java?rev=1779825&r1=1779824&r2=1779825&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-gradle-plugin/src/main/java/org/apache/meecrowave/gradle/MeecrowaveTask.java
(original)
+++ openwebbeans/meecrowave/trunk/meecrowave-gradle-plugin/src/main/java/org/apache/meecrowave/gradle/MeecrowaveTask.java
Sun Jan 22 15:13:03 2017
@@ -324,6 +324,10 @@ public class MeecrowaveTask extends Defa
     @Optional
     private String scanningPackageExcludes;
 
+    @Input
+    @Optional
+    private String tomcatAccessLogPattern;
+
     @TaskAction
     public void bake() {
         fixConfig();
@@ -1124,4 +1128,12 @@ public class MeecrowaveTask extends Defa
     public void setInjectServletContainerInitializer(final boolean injectServletContainerInitializer)
{
         this.injectServletContainerInitializer = injectServletContainerInitializer;
     }
+
+    public String getTomcatAccessLogPattern() {
+        return tomcatAccessLogPattern;
+    }
+
+    public void setTomcatAccessLogPattern(final String tomcatAccessLogPattern) {
+        this.tomcatAccessLogPattern = tomcatAccessLogPattern;
+    }
 }

Modified: openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/java/org/apache/meecrowave/maven/MeecrowaveRunMojo.java
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/java/org/apache/meecrowave/maven/MeecrowaveRunMojo.java?rev=1779825&r1=1779824&r2=1779825&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/java/org/apache/meecrowave/maven/MeecrowaveRunMojo.java
(original)
+++ openwebbeans/meecrowave/trunk/meecrowave-maven-plugin/src/main/java/org/apache/meecrowave/maven/MeecrowaveRunMojo.java
Sun Jan 22 15:13:03 2017
@@ -133,6 +133,9 @@ public class MeecrowaveRunMojo extends A
     @Parameter(property = "meecrowave.webXml")
     private String webXml;
 
+    @Parameter(property = "meecrowave.tomcatAccessLogPattern")
+    private String tomcatAccessLogPattern;
+
     @Parameter
     private Meecrowave.LoginConfigBuilder loginConfig;
 



Mime
View raw message