You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2013/11/16 13:32:46 UTC

git commit: Added log4j.properties file to haproxy extension and changed andes client log level to ERROR

Updated Branches:
  refs/heads/master ad1df3e11 -> 1dba19acc


Added log4j.properties file to haproxy extension and changed andes client log level to ERROR


Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/1dba19ac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/1dba19ac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/1dba19ac

Branch: refs/heads/master
Commit: 1dba19acc5c3d87a60b6715c55f1a87469c1eec3
Parents: ad1df3e
Author: Imesh Gunaratne <im...@apache.org>
Authored: Sat Nov 16 18:02:26 2013 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Sat Nov 16 18:02:26 2013 +0530

----------------------------------------------------------------------
 .../haproxy-extension/src/main/assembly/bin.xml |  3 +-
 .../src/main/bin/haproxy-extension.sh           |  5 ++-
 .../src/main/conf/log4j.properties              | 39 ++++++++++++++++++++
 .../apache/stratos/haproxy/extension/Main.java  | 11 +++++-
 .../distribution/src/main/conf/log4j.properties |  3 ++
 .../distribution/src/main/bin/stratos.sh        |  4 +-
 .../distribution/src/main/conf/log4j.properties |  2 +
 7 files changed, 61 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/1dba19ac/extensions/load-balancer/haproxy-extension/src/main/assembly/bin.xml
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/haproxy-extension/src/main/assembly/bin.xml b/extensions/load-balancer/haproxy-extension/src/main/assembly/bin.xml
index 63ab824..c21b4b0 100644
--- a/extensions/load-balancer/haproxy-extension/src/main/assembly/bin.xml
+++ b/extensions/load-balancer/haproxy-extension/src/main/assembly/bin.xml
@@ -39,6 +39,7 @@
             <fileMode>0600</fileMode>
             <includes>
                 <include>jndi.properties</include>
+                <include>log4j.properties</include>
             </includes>
         </fileSet>
         <fileSet>
@@ -46,7 +47,7 @@
             <outputDirectory>/security</outputDirectory>
             <fileMode>0600</fileMode>
             <includes>
-                <include>client-trustsore.jks</include>
+                <include>client-truststore.jks</include>
             </includes>
         </fileSet>
         <fileSet>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/1dba19ac/extensions/load-balancer/haproxy-extension/src/main/bin/haproxy-extension.sh
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/haproxy-extension/src/main/bin/haproxy-extension.sh b/extensions/load-balancer/haproxy-extension/src/main/bin/haproxy-extension.sh
index a5bd63f..be1f91e 100755
--- a/extensions/load-balancer/haproxy-extension/src/main/bin/haproxy-extension.sh
+++ b/extensions/load-balancer/haproxy-extension/src/main/bin/haproxy-extension.sh
@@ -27,11 +27,12 @@ properties="-Djndi.properties.dir=./../conf
             -Dexecutable.file.path=/Users/imesh/dist/haproxy/haproxy-1.4.24/haproxy
             -Dtemplates.path=./../templates
             -Dtemplates.name=haproxy.cfg.template
-            -Dconf.file.path=/tmp/haproxy.cfg"
+            -Dconf.file.path=/tmp/haproxy.cfg
+            -Dlog4j.properties.file.path=./../conf/log4j.properties
             -Djavax.net.ssl.trustStore=./../security/client-truststore.jks
             -Djavax.net.ssl.trustStorePassword=wso2carbon
             -Dthrift.receiver.ip=localhost
-            -Dthrift.receiver.port=7615
+            -Dthrift.receiver.port=7615"
 
 # Uncomment below line and add $debug next to $properties to enable remote debugging
 #debug="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/1dba19ac/extensions/load-balancer/haproxy-extension/src/main/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/haproxy-extension/src/main/conf/log4j.properties b/extensions/load-balancer/haproxy-extension/src/main/conf/log4j.properties
new file mode 100644
index 0000000..ceec8a7
--- /dev/null
+++ b/extensions/load-balancer/haproxy-extension/src/main/conf/log4j.properties
@@ -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.
+#
+
+# Set root logger level and appenders
+log4j.rootLogger=INFO, CONSOLE_APPENDER, FILE_APPENDER
+
+# CONSOLE_APPENDER is set to be a ConsoleAppender.
+log4j.appender.CONSOLE_APPENDER=org.apache.log4j.ConsoleAppender
+
+# The standard error log where all the warnings, errors and fatal errors will be logged
+log4j.appender.FILE_APPENDER=org.apache.log4j.FileAppender
+log4j.appender.FILE_APPENDER.File=/var/log/apache-stratos/cartridge-agent-event-publisher.log
+log4j.appender.FILE_APPENDER.layout=org.apache.log4j.PatternLayout
+log4j.appender.FILE_APPENDER.layout.ConversionPattern=%d{ISO8601} [%X{ip}-%X{host}] [%t] %5p %c{1} %m%n
+log4j.appender.FILE_APPENDER.threshold=DEBUG
+
+# CONSOLE_APPENDER uses PatternLayout.
+log4j.appender.CONSOLE_APPENDER.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE_APPENDER.layout.ConversionPattern=[%d{ISO8601}] %5p - [%c{1}] %m%n
+
+log4j.logger.org.apache.stratos.haproxy.extension=INFO
+log4j.logger.org.apache.stratos.messaging=INFO
+log4j.logger.org.wso2.andes.client=ERROR
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/1dba19ac/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Main.java
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Main.java b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Main.java
index ef586f5..fea9c2a 100644
--- a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Main.java
+++ b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Main.java
@@ -22,6 +22,7 @@ package org.apache.stratos.haproxy.extension;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.log4j.PropertyConfigurator;
 import org.apache.stratos.load.balancer.extension.api.LoadBalancerExtension;
 
 /**
@@ -31,7 +32,12 @@ public class Main {
     private static final Log log = LogFactory.getLog(Main.class);
 
     public static void main(String[] args) {
+
+        LoadBalancerExtension extension = null;
         try {
+            // Configure log4j properties
+            PropertyConfigurator.configure(System.getProperty("log4j.properties.file.path"));
+
             if(log.isInfoEnabled()) {
                 log.info("HAProxy extension started");
             }
@@ -57,7 +63,7 @@ public class Main {
 
             HAProxy haProxy = new HAProxy(executableFilePath, templatePath, templateName, confFilePath);
             HAProxyStatsReader statsReader = new HAProxyStatsReader();
-            LoadBalancerExtension extension = new LoadBalancerExtension(haProxy, statsReader);
+            extension = new LoadBalancerExtension(haProxy, statsReader);
             Thread thread = new Thread(extension);
             thread.start();
         }
@@ -65,6 +71,9 @@ public class Main {
             if(log.isErrorEnabled()) {
                 log.error(e);
             }
+            if(extension != null) {
+                extension.terminate();
+            }
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/1dba19ac/products/autoscaler/modules/distribution/src/main/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/products/autoscaler/modules/distribution/src/main/conf/log4j.properties b/products/autoscaler/modules/distribution/src/main/conf/log4j.properties
index b1b0d70..05f2042 100644
--- a/products/autoscaler/modules/distribution/src/main/conf/log4j.properties
+++ b/products/autoscaler/modules/distribution/src/main/conf/log4j.properties
@@ -55,8 +55,11 @@ log4j.logger.org.infinispan=WARN
 log4j.logger.org.jgroups=ERROR
 log4j.logger.me.prettyprint.cassandra.hector.TimingLogger=ERROR
 log4j.logger.org.wso2=INFO
+
 log4j.logger.org.apache.stratos.autoscaler=INFO
 log4j.logger.org.apache.stratos.messaging=INFO
+log4j.logger.org.wso2.andes.client=ERROR
+
 log4j.logger.org.apache.axis2.enterprise=FATAL, CARBON_LOGFILE, CARBON_MEMORY
 log4j.logger.org.opensaml.xml=WARN, CARBON_LOGFILE, CARBON_MEMORY
 log4j.logger.org.apache.directory.shared.ldap=WARN, CARBON_LOGFILE, CARBON_MEMORY

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/1dba19ac/products/load-balancer/modules/distribution/src/main/bin/stratos.sh
----------------------------------------------------------------------
diff --git a/products/load-balancer/modules/distribution/src/main/bin/stratos.sh b/products/load-balancer/modules/distribution/src/main/bin/stratos.sh
index abef45f..85dbd51 100644
--- a/products/load-balancer/modules/distribution/src/main/bin/stratos.sh
+++ b/products/load-balancer/modules/distribution/src/main/bin/stratos.sh
@@ -294,8 +294,8 @@ exec "$JAVACMD" \
         -Dcom.atomikos.icatch.file="$CARBON_HOME/lib/transactions.properties" \
         -Dcom.atomikos.icatch.hide_init_file_path=true \
         -Dorg.terracotta.quartz.skipUpdateCheck=true \
-        -Djavax.net.ssl.trustStore=$CARBON_HOME/repository/resources/security/client-truststore.jks
-        -Djavax.net.ssl.trustStorePassword=wso2carbon
+        -Djavax.net.ssl.trustStore=$CARBON_HOME/repository/resources/security/client-truststore.jks \
+        -Djavax.net.ssl.trustStorePassword=wso2carbon \
         -Dthrift.receiver.ip=localhost \
         -Dthrift.receiver.port=7615 \
         org.wso2.carbon.bootstrap.Bootstrap $*

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/1dba19ac/products/load-balancer/modules/distribution/src/main/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/products/load-balancer/modules/distribution/src/main/conf/log4j.properties b/products/load-balancer/modules/distribution/src/main/conf/log4j.properties
index 7e985aa..1942895 100644
--- a/products/load-balancer/modules/distribution/src/main/conf/log4j.properties
+++ b/products/load-balancer/modules/distribution/src/main/conf/log4j.properties
@@ -48,8 +48,10 @@ log4j.logger.com.atomikos=INFO,ATOMIKOS
 log4j.logger.org.quartz=WARN
 log4j.logger.org.wso2=INFO
 log4j.logger.org.wso2.carbon=INFO
+
 log4j.logger.org.apache.stratos.load.balancer=INFO
 log4j.logger.org.apache.stratos.messaging=INFO
+log4j.logger.org.wso2.andes.client=ERROR
 
 log4j.logger.org.apache.catalina=WARN
 log4j.logger.org.apache.synapse.endpoints.EndpointContext=ERROR