Repository: logging-log4j-audit
Updated Branches:
  refs/heads/master 540d9e579 -> a57e2f232


Catalog Editor now uses Spring Boot


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

Branch: refs/heads/master
Commit: a57e2f2322ef19406237f2478857273e16a45946
Parents: 540d9e5
Author: Ralph Goers <rgo...@apache.org>
Authored: Tue Mar 13 21:02:19 2018 -0700
Committer: Ralph Goers <rgo...@apache.org>
Committed: Tue Mar 13 21:02:19 2018 -0700

----------------------------------------------------------------------
 .../api/annotation/JdbcUrlCondition.java        |  22 ++--
 .../catalog/jpa/config/EclipseLinkConfig.java   |   5 +
 .../jpa/config/HsqldbDataSourceConfig.java      |   6 +-
 .../jpa/config/PostgresqlDataSourceConfig.java  |   5 +
 log4j-catalog/log4j-catalog-war/pom.xml         | 105 ++++++++++-----
 .../log4j/catalog/AuditCatalogEditor.java       |  86 ++++++++++++
 .../log4j/catalog/config/WebAppInitializer.java |  41 ++++--
 .../log4j/catalog/config/WebMvcAppContext.java  |   9 +-
 .../src/main/resources/log4j2.xml               |   4 +-
 pom.xml                                         | 131 +++----------------
 10 files changed, 236 insertions(+), 178 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/a57e2f23/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/annotation/JdbcUrlCondition.java
----------------------------------------------------------------------
diff --git 
a/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/annotation/JdbcUrlCondition.java
 
b/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/annotation/JdbcUrlCondition.java
index 435558b..84ebbbe 100644
--- 
a/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/annotation/JdbcUrlCondition.java
+++ 
b/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/annotation/JdbcUrlCondition.java
@@ -17,6 +17,8 @@ package org.apache.logging.log4j.catalog.api.annotation;
 
 import java.util.Map;
 
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.springframework.context.annotation.Condition;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.core.env.Environment;
@@ -26,6 +28,8 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
  *
  */
 public class JdbcUrlCondition implements Condition {
+
+    private static final Logger LOGGER = 
LogManager.getLogger(JdbcUrlCondition.class);
     @Override
     public boolean matches(ConditionContext context, AnnotatedTypeMetadata 
metadata) {
         Environment env = context.getEnvironment();
@@ -34,18 +38,20 @@ public class JdbcUrlCondition implements Condition {
             String value = map.get("value").toString();
             String jdbcUrl = env.getProperty("jdbcUrl");
             Boolean isEmbedded = 
Boolean.parseBoolean(env.getProperty("isEmbedded"));
+            boolean result;
             if (value.equals("hsqldb")) {
-                return jdbcUrl == null || isEmbedded;
-            }
-            if (jdbcUrl == null || isEmbedded) {
-                return false;
-            }
-            if (!jdbcUrl.startsWith("jdbc:")) {
-                return false;
+                result = jdbcUrl == null || isEmbedded;
+            } else if (jdbcUrl == null || isEmbedded) {
+                result = false;
+            } else if (!jdbcUrl.startsWith("jdbc:")) {
+                result = false;
+            } else {
+                result = 
jdbcUrl.substring(5).toLowerCase().startsWith(value.toLowerCase());
             }
-            boolean result = 
jdbcUrl.substring(5).toLowerCase().startsWith(value.toLowerCase());
+            LOGGER.debug("Returning {} for {}", result, value);
             return result;
         }
+        LOGGER.debug("No data provided");
         return false;
     }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/a57e2f23/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/config/EclipseLinkConfig.java
----------------------------------------------------------------------
diff --git 
a/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/config/EclipseLinkConfig.java
 
b/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/config/EclipseLinkConfig.java
index 143e937..9ff9569 100644
--- 
a/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/config/EclipseLinkConfig.java
+++ 
b/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/config/EclipseLinkConfig.java
@@ -19,6 +19,8 @@ import javax.persistence.EntityManagerFactory;
 
 import java.util.Properties;
 
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -37,11 +39,14 @@ import 
org.springframework.transaction.annotation.EnableTransactionManagement;
 @Profile("eclipseLink")
 public class EclipseLinkConfig {
 
+    private static Logger LOGGER = 
LogManager.getLogger(EclipseLinkConfig.class);
+
     @Autowired
     private DataSourceConfig dataSourceConfig;
 
     @Bean
     public EntityManagerFactory entityManagerFactory() {
+        LOGGER.debug("Creating EclipseLink entity manager.");
         AbstractJpaVendorAdapter vendorAdapter = new 
EclipseLinkJpaVendorAdapter();
         vendorAdapter.setGenerateDdl(false);
         LocalContainerEntityManagerFactoryBean factory = new 
LocalContainerEntityManagerFactoryBean();

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/a57e2f23/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/config/HsqldbDataSourceConfig.java
----------------------------------------------------------------------
diff --git 
a/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/config/HsqldbDataSourceConfig.java
 
b/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/config/HsqldbDataSourceConfig.java
index e73035a..d4c4d80 100644
--- 
a/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/config/HsqldbDataSourceConfig.java
+++ 
b/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/config/HsqldbDataSourceConfig.java
@@ -18,6 +18,8 @@ package org.apache.logging.log4j.catalog.jpa.config;
 
 import javax.sql.DataSource;
 
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.catalog.api.annotation.JdbcUrl;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -31,9 +33,11 @@ import 
org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
 @JdbcUrl("hsqldb")
 public class HsqldbDataSourceConfig implements DataSourceConfig {
 
+    private static final Logger LOGGER = 
LogManager.getLogger(HsqldbDataSourceConfig.class);
+
     @Bean
     public DataSource dataSource() {
-        System.out.println("Running embedded database builder");
+        LOGGER.debug("Running embedded database builder");
         return new EmbeddedDatabaseBuilder()
                 .setType(EmbeddedDatabaseType.HSQL)
                 .addScript("classpath:sql/hsql/schema.sql")

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/a57e2f23/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/config/PostgresqlDataSourceConfig.java
----------------------------------------------------------------------
diff --git 
a/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/config/PostgresqlDataSourceConfig.java
 
b/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/config/PostgresqlDataSourceConfig.java
index 5a90989..2e70d3d 100644
--- 
a/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/config/PostgresqlDataSourceConfig.java
+++ 
b/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/config/PostgresqlDataSourceConfig.java
@@ -19,6 +19,8 @@ package org.apache.logging.log4j.catalog.jpa.config;
 import javax.sql.DataSource;
 
 import com.mchange.v2.c3p0.DriverManagerDataSource;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.catalog.api.annotation.JdbcUrl;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
@@ -31,6 +33,8 @@ import org.springframework.context.annotation.Configuration;
 @JdbcUrl("postgresql")
 public class PostgresqlDataSourceConfig implements DataSourceConfig {
 
+    private static final Logger LOGGER = 
LogManager.getLogger(PostgresqlDataSourceConfig.class);
+
     @Value("${jdbcUrl}")
     private String url;
 
@@ -42,6 +46,7 @@ public class PostgresqlDataSourceConfig implements 
DataSourceConfig {
 
     @Bean
     public DataSource dataSource() {
+        LOGGER.debug("Creating PostgresQL data source for {}", url);
         DriverManagerDataSource driver = new DriverManagerDataSource();
         driver.setDriverClass("org.postgresql.Driver");
         driver.setJdbcUrl(url);

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/a57e2f23/log4j-catalog/log4j-catalog-war/pom.xml
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/pom.xml 
b/log4j-catalog/log4j-catalog-war/pom.xml
index 4031968..14e9b41 100644
--- a/log4j-catalog/log4j-catalog-war/pom.xml
+++ b/log4j-catalog/log4j-catalog-war/pom.xml
@@ -23,13 +23,14 @@
                <version>1.0.0-SNAPSHOT</version>
        </parent>
        <artifactId>log4j-catalog-war</artifactId>
-       <packaging>war</packaging>
+       <packaging>jar</packaging>
 
        <name>Log4j Catalog Service</name>
        <url>http://maven.apache.org</url>
        <properties>
                
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <log4jParentDir>${basedir}/../..</log4jParentDir>
+    <java.version>1.8</java.version>
        </properties>
        <distributionManagement>
                <site>
@@ -37,7 +38,62 @@
                        
<url>scp://people.apache.org/www/logging.apache.org/log4j-audit/log4j-catalog/log4j-catalog-war</url>
                </site>
        </distributionManagement>
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-dependencies</artifactId>
+        <version>${spring.boot.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
        <dependencies>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-web</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>org.springframework.boot</groupId>
+          <artifactId>spring-boot-starter-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-thymeleaf</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-devtools</artifactId>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-log4j2</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-actuator</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-tomcat</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-thymeleaf</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.thymeleaf.extras</groupId>
+      <artifactId>thymeleaf-extras-java8time</artifactId>
+    </dependency>
                <dependency>
                        <groupId>jstl</groupId>
                        <artifactId>jstl</artifactId>
@@ -70,11 +126,7 @@
                        <groupId>org.apache.logging.log4j</groupId>
                        <artifactId>log4j-catalog-api</artifactId>
                </dependency>
-               <dependency>
-                       <groupId>org.slf4j</groupId>
-                       <artifactId>slf4j-api</artifactId>
-               </dependency>
-               <dependency>
+               <!-- <dependency>
                        <groupId>org.apache.httpcomponents</groupId>
                        <artifactId>httpclient</artifactId>
                </dependency>
@@ -105,12 +157,12 @@
                <dependency>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-core</artifactId>
-               </dependency>
+               </dependency> -->
                <dependency>
                        <groupId>org.springframework.data</groupId>
                        <artifactId>spring-data-rest-webmvc</artifactId>
                </dependency>
-               <dependency>
+               <!-- <dependency>
                        <groupId>javax.servlet</groupId>
                        <artifactId>javax.servlet-api</artifactId>
                        <scope>provided</scope>
@@ -151,7 +203,7 @@
                <dependency>
                        <groupId>org.mockito</groupId>
                        <artifactId>mockito-core</artifactId>
-               </dependency>
+               </dependency> -->
                <dependency>
                        <groupId>org.springframework.data</groupId>
                        <artifactId>spring-data-jpa</artifactId>
@@ -168,36 +220,29 @@
                        <groupId>org.modelmapper.extensions</groupId>
                        <artifactId>modelmapper-jackson</artifactId>
                </dependency>
-               <dependency>
+               <!-- <dependency>
                        <groupId>org.thymeleaf</groupId>
                        <artifactId>thymeleaf</artifactId>
                </dependency>
                <dependency>
                        <groupId>org.thymeleaf</groupId>
                        <artifactId>thymeleaf-spring4</artifactId>
-
-               </dependency>
+               </dependency>-->
        </dependencies>
        <build>
-               <finalName>AuditCatalog</finalName>
                <plugins>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-war-plugin</artifactId>
-                               <version>2.6</version>
-                               <configuration>
-                                       
<failOnMissingWebXml>false</failOnMissingWebXml>
-                               </configuration>
-                               <executions>
-                                       <execution>
-                                               <id>default-war</id>
-                                               <goals>
-                                                       <goal>war</goal>
-                                               </goals>
-                                               <phase>prepare-package</phase>
-                                       </execution>
-                               </executions>
-                       </plugin>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+        <version>${spring.boot.version}</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>repackage</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
                </plugins>
        </build>
 </project>

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/a57e2f23/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/AuditCatalogEditor.java
----------------------------------------------------------------------
diff --git 
a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/AuditCatalogEditor.java
 
b/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/AuditCatalogEditor.java
new file mode 100644
index 0000000..8a37bec
--- /dev/null
+++ 
b/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/AuditCatalogEditor.java
@@ -0,0 +1,86 @@
+/*
+ * 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.logging.log4j.catalog;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.catalog.api.util.ProfileUtil;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.support.SpringBootServletInitializer;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ *
+ */
+@SpringBootApplication
+public class AuditCatalogEditor extends SpringBootServletInitializer {
+    private static final String SPRING_PROFILE = "spring.profiles.active";
+
+    public static void main(String[] args) {
+        SpringApplicationBuilder builder = new 
SpringApplicationBuilder().profiles(getActiveProfile())
+            .sources(AuditCatalogEditor.class);
+        System.setProperty("isEmbedded", "true");
+        builder.run(args);
+    }
+
+    /**
+     * Get the active profile if none has been specified.
+     */
+    public static String getActiveProfile() {
+        String springProfile = System.getProperty(SPRING_PROFILE);
+        if (springProfile == null) {
+            springProfile = System.getenv(SPRING_PROFILE);
+        }
+        if (springProfile == null) {
+            Properties props = loadProperties();
+            springProfile = props.getProperty(SPRING_PROFILE);
+            if (springProfile == null) {
+                springProfile = "eclipseLink";
+            }
+        }
+        return springProfile;
+    }
+
+    private static Properties loadProperties() {
+        Properties props = new Properties();
+        String env = System.getProperty("env");
+        if (env == null) {
+            env = System.getenv("env");
+        }
+        StringBuilder sb = new StringBuilder("catalog-");
+        if (env != null) {
+            sb.append(env);
+        }
+        sb.append("config.properties");
+        InputStream is = 
ProfileUtil.class.getClassLoader().getResourceAsStream(sb.toString());
+        if (is != null) {
+            try {
+                props.load(is);
+            } catch (IOException ioe) {
+                //Ignore the error.
+            }
+        }
+        return props;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/a57e2f23/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/config/WebAppInitializer.java
----------------------------------------------------------------------
diff --git 
a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/config/WebAppInitializer.java
 
b/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/config/WebAppInitializer.java
index 0fcdab4..1e6f884 100644
--- 
a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/config/WebAppInitializer.java
+++ 
b/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/config/WebAppInitializer.java
@@ -16,7 +16,12 @@
  */
 package org.apache.logging.log4j.catalog.config;
 
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.catalog.api.util.ProfileUtil;
+import org.springframework.boot.web.servlet.ServletContextInitializer;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
 import org.springframework.web.WebApplicationInitializer;
 import org.springframework.web.context.ContextLoaderListener;
 import 
org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
@@ -26,22 +31,30 @@ import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 import javax.servlet.ServletRegistration;
 
-public class WebAppInitializer implements WebApplicationInitializer {
+public class WebAppInitializer {
     private static final String APPLICATION_NAME = "AuditCatalog";
+    private static Logger LOGGER = 
LogManager.getLogger(WebAppInitializer.class);
 
-    @Override
-    public void onStartup(ServletContext servletContext) throws 
ServletException {
-        servletContext.setInitParameter("applicationName", APPLICATION_NAME);
-        ProfileUtil.setActiveProfile(servletContext);
-        servletContext.setInitParameter("isEmbedded", "true");
-        System.setProperty("applicationName", APPLICATION_NAME);
-        AnnotationConfigWebApplicationContext rootContext = new 
AnnotationConfigWebApplicationContext();
-        rootContext.setDisplayName(APPLICATION_NAME);
-        rootContext.register(WebMvcAppContext.class);
-        servletContext.addListener(new ContextLoaderListener(rootContext));
+    @Bean
+    public ServletContextInitializer initializer() {
+        return new ServletContextInitializer() {
 
-        ServletRegistration.Dynamic restServlet = 
servletContext.addServlet("dispatcherServlet", new 
DispatcherServlet(rootContext));
-        restServlet.setLoadOnStartup(1);
-        restServlet.addMapping("/*");
+            @Override
+            public void onStartup(ServletContext servletContext) throws 
ServletException {
+                LOGGER.info("Starting Audit Catalog Editor");
+                servletContext.setInitParameter("applicationName", 
APPLICATION_NAME);
+                ProfileUtil.setActiveProfile(servletContext);
+                servletContext.setInitParameter("isEmbedded", "true");
+                System.setProperty("applicationName", APPLICATION_NAME);
+                //AnnotationConfigWebApplicationContext rootContext = new 
AnnotationConfigWebApplicationContext();
+                //rootContext.setDisplayName(APPLICATION_NAME);
+                //rootContext.register(WebMvcAppContext.class);
+                //servletContext.addListener(new 
ContextLoaderListener(rootContext));
+
+                //ServletRegistration.Dynamic restServlet = 
servletContext.addServlet("dispatcherServlet", new 
DispatcherServlet(rootContext));
+                //restServlet.setLoadOnStartup(1);
+                //restServlet.addMapping("/*");
+            }
+        };
     }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/a57e2f23/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/config/WebMvcAppContext.java
----------------------------------------------------------------------
diff --git 
a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/config/WebMvcAppContext.java
 
b/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/config/WebMvcAppContext.java
index 1e1627a..181024d 100644
--- 
a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/config/WebMvcAppContext.java
+++ 
b/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/config/WebMvcAppContext.java
@@ -66,8 +66,6 @@ import 
org.springframework.web.servlet.config.annotation.EnableWebMvc;
 import 
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
 import 
org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
 import 
org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
-import org.springframework.web.servlet.view.InternalResourceViewResolver;
-import org.springframework.web.servlet.view.JstlView;
 import org.thymeleaf.spring4.SpringTemplateEngine;
 import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver;
 import org.thymeleaf.spring4.view.ThymeleafView;
@@ -77,10 +75,8 @@ import org.thymeleaf.templatemode.TemplateMode;
 import static org.apache.commons.lang3.StringUtils.isNotBlank;
 
 @Configuration
-@EnableWebMvc
-@EnableScheduling
 @ComponentScan(basePackages = {"org.apache.logging.log4j.catalog"})
-@PropertySource("classpath:catalog-${env:}config.properties")
+//@PropertySource(value = "classpath:catalog-${env:}config.properties", 
ignoreResourceNotFound = true)
 public class WebMvcAppContext extends WebMvcConfigurerAdapter implements 
ApplicationContextAware {
 
     private static final Logger LOGGER = 
LogManager.getLogger(WebMvcAppContext.class);
@@ -168,8 +164,8 @@ public class WebMvcAppContext extends 
WebMvcConfigurerAdapter implements Applica
         return new 
LocalAuthorizationInterceptor(configurationService.getCatalogServiceAuthToken());
     }
 
-    @Bean
     public ObjectMapper objectMapper() {
+        LOGGER.debug("Creating custom ObjectMapper");
         ObjectMapper mapper = JsonObjectMapperFactory.createMapper();
         SimpleFilterProvider filterProvider = new SimpleFilterProvider();
         filterProvider.addFilter("catalogEvent", new CatalogEventFilter());
@@ -177,7 +173,6 @@ public class WebMvcAppContext extends 
WebMvcConfigurerAdapter implements Applica
         return mapper;
     }
 
-    @Bean
     public MappingJackson2HttpMessageConverter jsonMessageConverter() {
         return new MappingJackson2HttpMessageConverter(objectMapper());
     }

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/a57e2f23/log4j-catalog/log4j-catalog-war/src/main/resources/log4j2.xml
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/resources/log4j2.xml 
b/log4j-catalog/log4j-catalog-war/src/main/resources/log4j2.xml
index 34e18ec..dbc8075 100644
--- a/log4j-catalog/log4j-catalog-war/src/main/resources/log4j2.xml
+++ b/log4j-catalog/log4j-catalog-war/src/main/resources/log4j2.xml
@@ -17,7 +17,7 @@
   -->
 <Configuration status="ERROR">
     <properties>
-        <property 
name="LOG_DIR">${sys:catalina.home}/logs/AuditCatalog</property>
+        <property 
name="LOG_DIR">${sys:catalina.home:-.}/logs/AuditCatalog</property>
     </properties>
     <Appenders>
         <Console name="Console" target="SYSTEM_OUT">
@@ -36,7 +36,7 @@
         <Logger name="org.apache.logging.log4j.catalog" level="WARN" 
additivity="false">
             <AppenderRef ref="log4j"/>
         </Logger>
-        <Root level="INFO">
+        <Root level="DEBUG">
             <AppenderRef ref="log4j" />
         </Root>
     </Loggers>

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/a57e2f23/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 91a0f31..d0535c1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -150,6 +150,7 @@
     <release.plugin.version>2.5.3</release.plugin.version>
     <scm.plugin.version>1.9.4</scm.plugin.version>
     <site.plugin.version>3.4</site.plugin.version>
+    <spring.boot.version>1.5.10.RELEASE</spring.boot.version>
     <slf4j.version>1.8.0-alpha2</slf4j.version>
     <spring.version>4.3.11.RELEASE</spring.version>
     <spring.agent.version>2.5.6</spring.agent.version>
@@ -164,6 +165,8 @@
     <swagger.ui.version>2.2.2</swagger.ui.version>
     <swagger.annotations.version>1.5.8</swagger.annotations.version>
     <thymeleaf.version>3.0.6.RELEASE</thymeleaf.version>
+    
<thymeleaf-extras-java8time.version>3.0.0.RELEASE</thymeleaf-extras-java8time.version>
+    <thymeleaf-layout-dialect.version>2.2.2</thymeleaf-layout-dialect.version>
     <c3p0.version>0.9.5.2</c3p0.version>
     <serp.version>1.15.1</serp.version>
     <!-- make sure to update these for each release! -->
@@ -192,7 +195,13 @@
   </pluginRepositories>
   <dependencyManagement>
     <dependencies>
-
+      <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-dependencies</artifactId>
+        <version>${spring.boot.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
       <dependency>
         <groupId>org.apache.logging.log4j</groupId>
         <artifactId>log4j-audit-api</artifactId>
@@ -486,121 +495,6 @@
         <version>${slf4j.version}</version>
       </dependency>
       <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-agent</artifactId>
-        <version>${spring.agent.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-beans</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-core</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-context</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-context-support</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework.data</groupId>
-        <artifactId>spring-data-jpa</artifactId>
-        <version>${spring.data.jpa.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework.data</groupId>
-        <artifactId>spring-data-redis</artifactId>
-        <version>${spring.data.redis.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework.data</groupId>
-        <artifactId>spring-data-rest-webmvc</artifactId>
-        <version>${spring.data.rest.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-expression</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework.security</groupId>
-        <artifactId>spring-security-core</artifactId>
-        <version>${spring.security.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-test</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-tx</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-orm</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-jdbc</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-web</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-webmvc</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-aop</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework</groupId>
-        <artifactId>spring-aspects</artifactId>
-        <version>${spring.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework.ws</groupId>
-        <artifactId>spring-ws-core</artifactId>
-        <version>${spring.ws.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework.ws</groupId>
-        <artifactId>spring-ws-security</artifactId>
-        <version>${spring.ws.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework.ws</groupId>
-        <artifactId>spring-xml</artifactId>
-        <version>${spring.ws.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework.hateoas</groupId>
-        <artifactId>spring-hateoas</artifactId>
-        <version>${spring.hateoas.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.springframework.data</groupId>
-        <artifactId>spring-data-commons</artifactId>
-        <version>1.13.3.RELEASE</version>
-      </dependency>
-      <dependency>
         <groupId>org.aspectj</groupId>
         <artifactId>aspectjweaver</artifactId>
         <version>1.8.9</version>
@@ -646,6 +540,11 @@
         <version>${thymeleaf.version}</version>
       </dependency>
       <dependency>
+        <groupId>nz.net.ultraq.thymeleaf</groupId>
+        <artifactId>thymeleaf-layout-dialect</artifactId>
+        <version>${thymeleaf-layout-dialect.version}</version>
+      </dependency>
+      <dependency>
         <groupId>com.jcraft</groupId>
         <artifactId>jsch</artifactId>
         <version>0.1.54</version>

Reply via email to