[log4j2] Copying template files in setup task and cleaning config scripts.
authorJavier Armendáriz <javier.armendariz@openbravo.com>
Mon, 15 Oct 2018 10:03:04 +0200
changeset 35011 4099d7b5ceca
parent 35010 58ed76aaa521
child 35012 19993e7ff506
[log4j2] Copying template files in setup task and cleaning config scripts.
src-util/diagnostic/build.xml
src/build.xml
src/org/openbravo/configuration/ConfigurationApp.java
--- a/src-util/diagnostic/build.xml	Thu Oct 11 16:54:09 2018 +0200
+++ b/src-util/diagnostic/build.xml	Mon Oct 15 10:03:04 2018 +0200
@@ -12,7 +12,7 @@
 * under the License.
 * The Original Code is Openbravo ERP.
 * The Initial Developer of the Original Code is Openbravo SLU
-* All portions are Copyright (C) 2008 Openbravo SLU
+* All portions are Copyright (C) 2008-2018 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************
@@ -89,10 +89,16 @@
   </target>
 
   <target name="check.log4j">
-    <echo message="Checking for log4j.lcf file..." />
-    <available file="../../config/log4j.lcf" property="isLog4j" />
-    <fail unless="isLog4j" message="log4j.lcf file not available. Tip: move config/log4j.lcf.template file to config/log4j.lcf and configure it" />
-    <echo message="log4j.lcf file OK" />
+    <echo message="Checking for log4j2*.xml files..." />
+    <condition property="isLog4j">
+      <and>
+        <available file="../../config/log4j2.xml" />
+        <available file="../../config/log4j2-web.xml" />
+      </and>
+    </condition>
+
+    <fail unless="isLog4j" message="log4j2.xml and/or log4j2-web.xml file not available. Tip: copy config/log4j2.xml.template and config/log4j2-web.xml files removing the .template prefix and configure them" />
+    <echo message="log4j2 configuration files OK" />
   </target>
 
   <target name="check.permissions" if="isCheckPerms">
--- a/src/build.xml	Thu Oct 11 16:54:09 2018 +0200
+++ b/src/build.xml	Mon Oct 15 10:03:04 2018 +0200
@@ -187,7 +187,6 @@
       </syspropertyset>
     </java>
     <copy file="${base.src}/buildAD.xml" tofile="${build.AD}/build.xml" />
-    <copy file="${base.src}/log4j.lcf" tofile="${build.AD}/log4j.lcf" />
     <ant dir="${build.AD}" target="buildAD" inheritAll="true" inheritRefs="true" />
   </target>
 
--- a/src/org/openbravo/configuration/ConfigurationApp.java	Thu Oct 11 16:54:09 2018 +0200
+++ b/src/org/openbravo/configuration/ConfigurationApp.java	Mon Oct 15 10:03:04 2018 +0200
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2014 - 2016 Openbravo SLU
+ * All portions are Copyright (C) 2014 - 2018 Openbravo SLU
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -52,12 +52,15 @@
   private final static String BASEDIR = getUserDir();
   private final static String BASEDIR_CONFIG = BASEDIR + "/config/";
   private final static String BASEDIR_TEST = BASEDIR + "/src-test/";
+  private final static String BASEDIR_TEST_SRC = BASEDIR + "/src-test/src/";
   private final static String SUFFIX_AUX = ".aux";
   private final static String OPENBRAVO_PROPERTIES = BASEDIR_CONFIG + "Openbravo.properties";
   private final static String OPENBRAVO_PROPERTIES_AUX = BASEDIR_CONFIG + "Openbravo.properties"
       + SUFFIX_AUX;
   private final static String FORMAT_XML = BASEDIR_CONFIG + "Format.xml";
-  private final static String LOG4J_LCF = BASEDIR_CONFIG + "log4j.lcf";
+  private final static String LOG4J2_XML = BASEDIR_CONFIG + "log4j2.xml";
+  private final static String LOG4J2TEST_XML = BASEDIR_CONFIG + "log4j2-test.xml";
+  private final static String LOG4J2WEB_XML = BASEDIR_CONFIG + "log4j2-web.xml";
   private final static String USERCONFIG_XML = BASEDIR_CONFIG + "userconfig.xml";
   private final static String COMMON_COMPONENT = ".settings/org.eclipse.wst.common.component";
   private final static String CLASSPATH = ".classpath";
@@ -738,10 +741,13 @@
    */
   private static void fileCopySomeTemplates(Project p) {
     fileCopyTemplate(FORMAT_XML + ".template", FORMAT_XML, p);
-    fileCopyTemplate(LOG4J_LCF + ".template", LOG4J_LCF, p);
+    fileCopyTemplate(LOG4J2_XML + ".template", LOG4J2_XML, p);
+    fileCopyTemplate(LOG4J2WEB_XML + ".template", LOG4J2WEB_XML, p);
     fileCopyTemplate(USERCONFIG_XML + ".template", USERCONFIG_XML, p);
     fileCopyTemplate(CLASSPATH + ".template", CLASSPATH, p);
     fileCopyTemplate(BASEDIR_TEST + CLASSPATH + ".template", BASEDIR_TEST + CLASSPATH, p);
+    fileCopyTemplate(BASEDIR_TEST_SRC + LOG4J2TEST_XML + ".template", BASEDIR_TEST_SRC
+        + LOG4J2TEST_XML, p);
   }
 
   /**