[log4j2] Build process works with new logger.
authorJavier Armendáriz <javier.armendariz@openbravo.com>
Fri, 05 Oct 2018 09:13:56 +0200
changeset 34968 9982442e7119
parent 34967 afda97e3cea2
child 34969 25d8e4fd1bf5
[log4j2] Build process works with new logger.

Logger configuration is located in src/ and this path should be added in build
classpath for trl, wad and dbsm tasks.
build.xml
config/log4j2-web.xml
config/log4j2.xml
lib/runtime/log4j-api-2.11.1.jar
modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationComponentProvider.java
src-core/src/org/openbravo/base/BuildTask.java
src-core/src/org/openbravo/utils/OBRebuildAppender.java
src-db/database/build-create.xml
src-db/database/build.xml
src-trl/build.xml
src-util/buildvalidation/build.xml
src-wad/build.xml
src/log4j2.xml
--- a/build.xml	Wed Oct 03 13:41:29 2018 +0200
+++ b/build.xml	Fri Oct 05 09:13:56 2018 +0200
@@ -230,6 +230,7 @@
     <fileset dir="${build.wad.lib}">
       <include name="openbravo-wad.jar" />
     </fileset>
+    <pathelement path="${base.config}" />
   </path>
 
   <path id="project.class.path">
@@ -237,6 +238,7 @@
       <include name="*/build/classes/" />
     </dirset>
     <pathelement path="${basedir}/src-util/modulescript/build/classes/" />
+    <pathelement path="${base.config}" />
     <pathelement path="${build}" />
     <pathelement path="${base.src}" />
     <fileset dir="${base.lib}">
@@ -271,6 +273,7 @@
     </dirset>
     <pathelement path="${basedir}/../../src-util/modulescript/build/classes/" />
     <pathelement path="${build.apply.module}" />
+    <pathelement path="${base.config}" />
     <pathelement path="${base.src}" />
     <fileset dir="${base.lib}">
       <include name="**/*.jar" />
@@ -301,6 +304,7 @@
       <include name="*/build/classes/" />
     </dirset>
     <pathelement path="${basedir}/../../src-util/modulescript/build/classes/" />
+    <pathelement path="${base.config}" />
     <pathelement path="${build.apply.module}" />
     <pathelement path="${build}" />
     <pathelement path="${base.src}" />
@@ -1017,7 +1021,9 @@
       <arg line="'${base.config}/Openbravo.properties' ${logFileName}" />
       <classpath>
         <pathelement path="${build.core.lib}/openbravo-core.jar" />
-        <pathelement path="${base.lib}/runtime/log4j-1.2.16.jar" />
+        <pathelement path="${base.lib}/runtime/log4j-1.2-api-2.11.1.jar" />
+        <pathelement path="${base.lib}/runtime/log4j-api-2.11.1.jar" />
+        <pathelement path="${base.lib}/runtime/log4j-core-2.11.1.jar" />
         <pathelement path="${base.lib}/runtime/commons-pool-1.5.6.jar" />
         <pathelement path="${base.lib}/runtime/commons-dbcp-1.4.jar" />
         <pathelement path="${base.lib}/runtime/postgresql-42.2.2.jre7.jar" />
--- a/config/log4j2-web.xml	Wed Oct 03 13:41:29 2018 +0200
+++ b/config/log4j2-web.xml	Fri Oct 05 09:13:56 2018 +0200
@@ -6,7 +6,7 @@
     </Console>
   </Appenders>
   <Loggers>
-    <Root level="info">
+    <Root level="INFO">
       <AppenderRef ref="Console"/>
     </Root>
   </Loggers>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/config/log4j2.xml	Fri Oct 05 09:13:56 2018 +0200
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration status="WARN">
+  <Appenders>
+    <Console name="Console" target="SYSTEM_OUT">
+      <PatternLayout pattern="BUILD %d{HH:mm:ss.SSS} [%t] %-5level %l{1.}-- %msg%n"/>
+    </Console>
+  </Appenders>
+  <Loggers>
+    <Root level="INFO">
+      <AppenderRef ref="Console"/>
+    </Root>
+  </Loggers>
+</Configuration>
\ No newline at end of file
Binary file lib/runtime/log4j-api-2.11.1.jar has changed
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationComponentProvider.java	Wed Oct 03 13:41:29 2018 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationComponentProvider.java	Fri Oct 05 09:13:56 2018 +0200
@@ -120,10 +120,9 @@
         "web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk.js", true));
     globalResources.add(createStaticResource(
         "web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js", true));
-    globalResources
-        .add(createStaticResource(
-            "web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js",
-            true));
+    globalResources.add(createStaticResource(
+        "web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js",
+        true));
     globalResources.add(createStaticResource(
         "web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js", true));
     globalResources.add(createStaticResource(
@@ -133,10 +132,9 @@
         true));
     globalResources.add(createStaticResource(
         "web/org.openbravo.client.application/js/form/formitem/ob-formitem-section.js", true));
-    globalResources
-        .add(createStaticResource(
-            "web/org.openbravo.client.application/js/form/formitem/ob-formitem-section-audit.js",
-            true));
+    globalResources.add(createStaticResource(
+        "web/org.openbravo.client.application/js/form/formitem/ob-formitem-section-audit.js",
+        true));
     globalResources.add(createStaticResource(
         "web/org.openbravo.client.application/js/form/formitem/ob-formitem-textarea.js", true));
     globalResources.add(createStaticResource(
@@ -159,14 +157,14 @@
         "web/org.openbravo.client.application/js/form/formitem/ob-formitem-image.js", true));
     globalResources.add(createStaticResource(
         "web/org.openbravo.client.application/js/navbar/ob-application-menu.js", false));
-    globalResources.add(createStaticResource(
-        "web/org.openbravo.client.application/js/main/ob-tab.js", false));
+    globalResources
+        .add(createStaticResource("web/org.openbravo.client.application/js/main/ob-tab.js", false));
     globalResources.add(createStaticResource(
         "web/org.openbravo.client.application/js/calendar/ob-calendar.js", true));
     globalResources.add(createStaticResource(
         "web/org.openbravo.client.application/js/calendar/ob-multicalendar.js", true));
-    globalResources.add(createStaticResource(
-        "web/org.openbravo.client.application/js/grid/ob-grid.js", false));
+    globalResources.add(
+        createStaticResource("web/org.openbravo.client.application/js/grid/ob-grid.js", false));
     globalResources.add(createStaticResource(
         "web/org.openbravo.client.application/js/grid/ob-tree-grid.js", false));
     globalResources.add(createStaticResource(
@@ -258,26 +256,22 @@
         false));
     globalResources.add(createStaticResource(
         "web/org.openbravo.client.application/js/personalization/ob-personalize-form.js", false));
-    globalResources
-        .add(createStaticResource(
-            "web/org.openbravo.client.application/js/personalization/ob-personalize-form-toolbar-button.js",
-            false));
+    globalResources.add(createStaticResource(
+        "web/org.openbravo.client.application/js/personalization/ob-personalize-form-toolbar-button.js",
+        false));
     globalResources.add(createStaticResource(
         "web/org.openbravo.client.application/js/personalization/ob-manage-views.js", false));
-    globalResources
-        .add(createStaticResource(
-            "web/org.openbravo.client.application/js/personalization/ob-manage-views-popups.js",
-            false));
-    globalResources
-        .add(createStaticResource(
-            "web/org.openbravo.client.application/js/personalization/ob-manage-views-toolbar.js",
-            false));
+    globalResources.add(createStaticResource(
+        "web/org.openbravo.client.application/js/personalization/ob-manage-views-popups.js",
+        false));
+    globalResources.add(createStaticResource(
+        "web/org.openbravo.client.application/js/personalization/ob-manage-views-toolbar.js",
+        false));
 
     // Process
-    globalResources
-        .add(createStaticResource(
-            "web/org.openbravo.client.application/js/process/ob-pick-and-execute-datasource.js",
-            false));
+    globalResources.add(createStaticResource(
+        "web/org.openbravo.client.application/js/process/ob-pick-and-execute-datasource.js",
+        false));
     globalResources.add(createStaticResource(
         "web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js", false));
     globalResources.add(createStaticResource(
@@ -313,110 +307,109 @@
         false));
 
     // Styling
-    globalResources.add(createStyleSheetResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStyleSheetResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-application-menu-styles.css", false));
-    globalResources.add(createStyleSheetResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStyleSheetResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-tab-styles.css", false));
-    globalResources.add(createStyleSheetResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStyleSheetResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-form-styles.css", false));
-    globalResources.add(createStyleSheetResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStyleSheetResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-calendar-styles.css", false));
-    globalResources.add(createStyleSheetResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStyleSheetResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-grid-styles.css", false));
-    globalResources.add(createStyleSheetResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStyleSheetResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-tree-grid-styles.css", false));
-    globalResources.add(createStyleSheetResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStyleSheetResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-navigation-bar-styles.css", false));
-    globalResources.add(createStyleSheetResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStyleSheetResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-popup-styles.css", false));
-    globalResources.add(createStyleSheetResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStyleSheetResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-process-styles.css", false));
-    globalResources.add(createStyleSheetResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStyleSheetResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-dialog-styles.css", false));
-    globalResources.add(createStyleSheetResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStyleSheetResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-toolbar-styles.css", false));
-    globalResources.add(createStyleSheetResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStyleSheetResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-messagebar-styles.css", false));
-    globalResources.add(createStyleSheetResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStyleSheetResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-statusbar-styles.css", false));
-    globalResources.add(createStyleSheetResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStyleSheetResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-application-styles.css", false));
 
+    globalResources
+        .add(createStaticResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+            + KernelConstants.SKIN_PARAMETER
+            + "/org.openbravo.client.application/ob-application-menu-styles.js", false));
     globalResources.add(createStaticResource(
         "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
-            + KernelConstants.SKIN_PARAMETER
-            + "/org.openbravo.client.application/ob-application-menu-styles.js", false));
+            + KernelConstants.SKIN_PARAMETER + "/org.openbravo.client.application/ob-tab-styles.js",
+        false));
     globalResources
-        .add(createStaticResource(
-            "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
-                + KernelConstants.SKIN_PARAMETER
-                + "/org.openbravo.client.application/ob-tab-styles.js", false));
-    globalResources.add(createStaticResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+        .add(createStaticResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-form-styles.js", false));
-    globalResources.add(createStaticResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStaticResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-calendar-styles.js", false));
-    globalResources.add(createStaticResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStaticResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-grid-styles.js", false));
-    globalResources.add(createStaticResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStaticResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-tree-grid-styles.js", false));
-    globalResources.add(createStaticResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStaticResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-toolbar-styles.js", false));
-    globalResources.add(createStaticResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStaticResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-messagebar-styles.js", false));
-    globalResources.add(createStaticResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStaticResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-statusbar-styles.js", false));
-    globalResources.add(createStaticResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStaticResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-popup-styles.js", false));
-    globalResources.add(createStaticResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStaticResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-process-styles.js", false));
-    globalResources.add(createStaticResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStaticResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-dialog-styles.js", false));
 
@@ -424,12 +417,12 @@
         "web/org.openbravo.client.application/js/navbar/ob-quick-launch.js", false));
 
     // before the main layout
-    globalResources.add(createStaticResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStaticResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-application-styles.js", false));
-    globalResources.add(createStaticResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStaticResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-navigation-bar-styles.js", false));
 
@@ -442,8 +435,8 @@
     }
     globalResources.add(createStaticResource(
         "web/org.openbravo.client.application/js/main/ob-notes-datasource.js", false));
-    globalResources.add(createStaticResource(
-        "web/org.openbravo.client.application/js/main/ob-layout.js", false));
+    globalResources.add(
+        createStaticResource("web/org.openbravo.client.application/js/main/ob-layout.js", false));
     globalResources.add(createStaticResource(
         "web/org.openbravo.client.application/js/utilities/ob-view-manager.js", false));
     globalResources.add(createStaticResource(
@@ -452,25 +445,25 @@
         "web/org.openbravo.client.application/js/utilities/ob-history-manager.js", false));
 
     // personalization
-    globalResources.add(createStyleSheetResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStyleSheetResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-personalization-styles.css", false));
 
-    globalResources.add(createStaticResource(
-        "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+    globalResources
+        .add(createStaticResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-personalization-styles.js", false));
 
     // RTL files should be added at the end. Don't add more files after them
     if (OBContext.getOBContext().isRTL()) {
-      globalResources.add(createStyleSheetResource(
-          "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+      globalResources.add(
+          createStyleSheetResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
               + KernelConstants.SKIN_PARAMETER
               + "/org.openbravo.client.application/ob-rtl-styles.css", false));
 
-      globalResources.add(createStaticResource(
-          "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
+      globalResources
+          .add(createStaticResource("web/org.openbravo.userinterface.smartclient/openbravo/skins/"
               + KernelConstants.SKIN_PARAMETER
               + "/org.openbravo.client.application/ob-rtl-styles.js", false));
     }
@@ -486,6 +479,9 @@
     // Cancel and Replace
     globalResources.add(createStaticResource("web/js/cancelAndReplace.js", false));
 
+    globalResources.add(createStaticResource(
+        "web/org.openbravo.client.application/js/log-management/ob-log-manager.js", false));
+
     return globalResources;
   }
 
--- a/src-core/src/org/openbravo/base/BuildTask.java	Wed Oct 03 13:41:29 2018 +0200
+++ b/src-core/src/org/openbravo/base/BuildTask.java	Fri Oct 05 09:13:56 2018 +0200
@@ -1,6 +1,6 @@
 /*
  ************************************************************************************
- * Copyright (C) 2010-2011 Openbravo S.L.U.
+ * Copyright (C) 2010-2018 Openbravo S.L.U.
  * Licensed under the Apache Software License version 2.0
  * 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
@@ -12,18 +12,21 @@
 
 package org.openbravo.base;
 
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.core.config.Configuration;
+import org.apache.logging.log4j.core.config.LoggerConfig;
+import org.openbravo.database.CPStandAlone;
+import org.openbravo.database.ConnectionProvider;
+import org.openbravo.utils.OBRebuildAppender;
+
 import java.io.FileInputStream;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.util.Properties;
 import java.util.Vector;
-import java.util.logging.Level;
-
-import org.apache.log4j.LogManager;
-import org.apache.log4j.Logger;
-import org.apache.log4j.PropertyConfigurator;
-import org.openbravo.database.CPStandAlone;
-import org.openbravo.database.ConnectionProvider;
 
 /**
  * This class starts a build of Openbravo. It is designed to be called from the application itself
@@ -39,24 +42,7 @@
    * This class starts a build of Openbravo. The kind of build is decided by this class logic
    */
   public static void main(String[] args) throws Exception {
-
-    final Properties props = new Properties();
-    final String level = Level.INFO.toString();
-    props.setProperty("log4j.rootCategory", level + ",A,O2");
-    props.setProperty("log4j.appender.A", "org.apache.log4j.ConsoleAppender");
-    props.setProperty("log4j.appender.A.layout", "org.apache.log4j.PatternLayout");
-    props.setProperty("log4j.appender.A.layout.ConversionPattern", "%-4r %-5p - %m%n");
-    // we don't want debug logging from Digester/Betwixt
-    props.setProperty("log4j.logger.org.apache.commons", "WARN");
-    props.setProperty("log4j.logger.org.hibernate", "WARN");
-
-    // Adding properties for log of Improved Upgrade Process
-    props.setProperty("log4j.appender.O2", "org.openbravo.utils.OBRebuildAppender");
-    props.setProperty("log4j.appender.O2.layout", "org.apache.log4j.PatternLayout");
-    props.setProperty("log4j.appender.O2.layout.ConversionPattern", "%-4r [%t] %-5p %c - %m%n");
-    LogManager.resetConfiguration();
-    PropertyConfigurator.configure(props);
-    log = Logger.getLogger(BuildTask.class);
+    initializeLogger();
 
     propertiesFile = args[0];
     String logFileName = args[1];
@@ -99,6 +85,18 @@
     ant.closeLogFile();
   }
 
+  private static void initializeLogger() {
+    final LoggerContext context = LoggerContext.getContext(false);
+    final Configuration config = context.getConfiguration();
+
+    LoggerConfig rootLoggerConfig = config.getRootLogger();
+    rootLoggerConfig.addAppender(OBRebuildAppender.createAppender("OBRebuildAppender", null, null),
+        Level.WARN, null);
+
+    context.updateLoggers();
+    log = LogManager.getLogger(BuildTask.class);
+  }
+
   private static String getUnnapliedModules() throws Exception {
     String strSql = "SELECT JAVAPACKAGE AS NAME FROM AD_MODULE M "
         + " WHERE ISACTIVE='Y' AND (STATUS='I' OR STATUS='U' OR STATUS='P')  "
--- a/src-core/src/org/openbravo/utils/OBRebuildAppender.java	Wed Oct 03 13:41:29 2018 +0200
+++ b/src-core/src/org/openbravo/utils/OBRebuildAppender.java	Fri Oct 05 09:13:56 2018 +0200
@@ -11,36 +11,47 @@
  */
 package org.openbravo.utils;
 
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.core.*;
+import org.apache.logging.log4j.core.appender.AbstractAppender;
+import org.apache.logging.log4j.core.config.plugins.Plugin;
+import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
+import org.apache.logging.log4j.core.config.plugins.PluginElement;
+import org.apache.logging.log4j.core.config.plugins.PluginFactory;
+import org.openbravo.database.ConnectionProviderImpl;
+import org.openbravo.exception.NoConnectionAvailableException;
+import org.openbravo.exception.PoolNotFoundException;
+
 import java.io.File;
 import java.io.Serializable;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
 
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.core.Filter;
-import org.apache.logging.log4j.core.Layout;
-import org.apache.logging.log4j.core.LogEvent;
-import org.apache.logging.log4j.core.appender.AbstractAppender;
-import org.openbravo.database.ConnectionProviderImpl;
-import org.openbravo.exception.NoConnectionAvailableException;
-import org.openbravo.exception.PoolNotFoundException;
-
 /* This class inserts the rebuild log into a table in the database.
  * This information is used in the rebuild window in Openbravo
  */
+@Plugin(name = "OBRebuildAppender", category = Core.CATEGORY_NAME, elementType = Appender.ELEMENT_TYPE)
 public class OBRebuildAppender extends AbstractAppender {
 
+  private ConnectionProviderImpl cp;
+  private Connection connection;
+  private static String baseDir;
+
+  @PluginFactory
+  public static OBRebuildAppender createAppender(@PluginAttribute("name") String name,
+      @PluginElement("Filter") Filter filter,
+      @PluginElement("Layout") Layout<? extends Serializable> layout) {
+    return new OBRebuildAppender(name, filter, layout);
+  }
+
   protected OBRebuildAppender(String name, Filter filter, Layout<? extends Serializable> layout) {
     super(name, filter, layout);
   }
 
-  private ConnectionProviderImpl cp;
-  private Connection connection;
-  private static String baseDir;
-
   @Override
   public void append(LogEvent event) {
+    System.out.println("Holaaaaaaaa");
     if (event.getLevel().isLessSpecificThan(Level.INFO)) {
       return;
     }
@@ -84,8 +95,8 @@
     }
   }
 
-  private Connection getConnection()
-      throws PoolNotFoundException, NoConnectionAvailableException, SQLException {
+  private Connection getConnection() throws PoolNotFoundException, NoConnectionAvailableException,
+      SQLException {
     if (cp == null) {
       File fProp = null;
       if (baseDir != null) {
--- a/src-db/database/build-create.xml	Wed Oct 03 13:41:29 2018 +0200
+++ b/src-db/database/build-create.xml	Fri Oct 05 09:13:56 2018 +0200
@@ -30,8 +30,6 @@
     </and>
   </condition>
 
-
-
   <path id="runtime-classpath-create">
     <fileset dir="./lib">
       <include name="**/*.jar" />
@@ -40,6 +38,7 @@
     <fileset dir="${base.lib}">
       <include name="**/*.jar" />
     </fileset>
+    <pathelement path="${base.config}" />
   </path>
 
   <taskdef name="createdatabase" classname="org.openbravo.ddlutils.task.CreateDatabase">
--- a/src-db/database/build.xml	Wed Oct 03 13:41:29 2018 +0200
+++ b/src-db/database/build.xml	Fri Oct 05 09:13:56 2018 +0200
@@ -49,6 +49,7 @@
     <fileset dir="${base.lib}">
       <include name="**/*.jar" />
     </fileset>
+    <pathelement path="${base.config}" />
   </path>
 
   <taskdef name="createscript" classname="org.openbravo.ddlutils.task.CreateXML2SQL">
--- a/src-trl/build.xml	Wed Oct 03 13:41:29 2018 +0200
+++ b/src-trl/build.xml	Fri Oct 05 09:13:56 2018 +0200
@@ -39,7 +39,8 @@
     <fileset dir="${base.lib}">
      <include name="**/*.jar"/>
     </fileset>
-  </path>   
+    <pathelement path="${base.config}" />
+  </path>
 
   <target name="init">
     <mkdir dir="${build.trl}"/>
--- a/src-util/buildvalidation/build.xml	Wed Oct 03 13:41:29 2018 +0200
+++ b/src-util/buildvalidation/build.xml	Fri Oct 05 09:13:56 2018 +0200
@@ -32,6 +32,7 @@
     <fileset dir="${base.lib}">
       <include name="**/*.jar" />
     </fileset>
+    <pathelement path="${base.config}" />
   </path>
 
   <condition property="module.not.provided">
--- a/src-wad/build.xml	Wed Oct 03 13:41:29 2018 +0200
+++ b/src-wad/build.xml	Fri Oct 05 09:13:56 2018 +0200
@@ -41,6 +41,7 @@
     <fileset dir="${base.lib}">
       <include name="**/*.jar" />
     </fileset>
+    <pathelement path="${base.config}" />
   </path>
 
   <target name="init">
--- a/src/log4j2.xml	Wed Oct 03 13:41:29 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Configuration status="WARN">
-  <Appenders>
-    <Console name="Console" target="SYSTEM_OUT">
-      <PatternLayout pattern="RUNTIME BUILD %d{HH:mm:ss.SSS} [%t] %-5level %l{1.}-- %msg%n"/>
-    </Console>
-  </Appenders>
-  <Loggers>
-    <Root level="info">
-      <AppenderRef ref="Console"/>
-    </Root>
-  </Loggers>
-</Configuration>
\ No newline at end of file