cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject git commit: updated refs/heads/master to 574e716
Date Tue, 16 Apr 2013 08:53:10 GMT
Updated Branches:
  refs/heads/master 32c7e1d88 -> 574e71635


CLOUDSTACK-2033 Fix usage server startup and logging

Properly implement the Daemon interface

Initialize logging when the usage server is started as a daemon

Fix a few minor startup and packaging items.

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/574e7163
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/574e7163
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/574e7163

Branch: refs/heads/master
Commit: 574e716352290f9c34bfa7bd3134a13e0caa8da2
Parents: 32c7e1d
Author: Hugo Trippaers <htrippaers@schubergphilis.com>
Authored: Tue Apr 16 10:52:17 2013 +0200
Committer: Hugo Trippaers <htrippaers@schubergphilis.com>
Committed: Tue Apr 16 10:52:49 2013 +0200

----------------------------------------------------------------------
 build/replace.properties                   |    1 +
 packaging/centos63/cloud-usage.rc          |    2 +-
 packaging/centos63/cloud.spec              |    9 +--------
 packaging/centos63/replace.properties      |    2 +-
 usage/pom.xml                              |    5 +++++
 usage/src/com/cloud/usage/UsageServer.java |   16 ++++++++++++----
 6 files changed, 21 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/574e7163/build/replace.properties
----------------------------------------------------------------------
diff --git a/build/replace.properties b/build/replace.properties
index c9a93c2..265f335 100644
--- a/build/replace.properties
+++ b/build/replace.properties
@@ -27,3 +27,4 @@ MSMNTDIR=/mnt
 COMPONENTS-SPEC=components.xml
 AWSAPILOG=awsapi.log
 REMOTEHOST=localhost
+COMMONLIBDIR=C:\Users\htrippaers\eclipse_workspace\cloudstack\client\target\cloud-client-ui-4.2.0-SNAPSHOT\WEB-INF\classes

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/574e7163/packaging/centos63/cloud-usage.rc
----------------------------------------------------------------------
diff --git a/packaging/centos63/cloud-usage.rc b/packaging/centos63/cloud-usage.rc
index 76f0e06..a9b6047 100755
--- a/packaging/centos63/cloud-usage.rc
+++ b/packaging/centos63/cloud-usage.rc
@@ -58,7 +58,7 @@ export JAVA_HOME
 
 SCP=""
 DCP=""
-UCP=`ls /usr/share/cloudstack-usage/cloud-usage-*.jar`":"`ls /usr/share/cloudstack-usage/lib/*
| tr '\n' ':'`
+UCP=`ls /usr/share/cloudstack-usage/cloud-usage-*.jar`":"`ls /usr/share/cloudstack-usage/lib/*.jar
| tr '\n' ':'`
 JCP="/usr/share/java/commons-daemon.jar"
 
 # We need to append the JSVC daemon JAR to the classpath

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/574e7163/packaging/centos63/cloud.spec
----------------------------------------------------------------------
diff --git a/packaging/centos63/cloud.spec b/packaging/centos63/cloud.spec
index c2c6fe7..a7cc20e 100644
--- a/packaging/centos63/cloud.spec
+++ b/packaging/centos63/cloud.spec
@@ -447,13 +447,6 @@ if [ -f "%{_sysconfdir}/%{name}/management/db.properties" ]; then
     ln -s %{_sysconfdir}/%{name}/management/db.properties %{_sysconfdir}/%{name}/usage/db.properties
 fi
 
-if [ -f "%{_sysconfdir}/%{name}/management/log4j-cloud.xml" ]; then
-    echo Replacing log4j-cloud.xml with management server log4j-cloud.xml
-    rm -f %{_sysconfdir}/%{name}/usage/log4j-cloud.xml
-    ln -s %{_sysconfdir}/%{name}/management/log4j-cloud.xml %{_sysconfdir}/%{name}/usage/log4j-cloud.xml
-fi
-
-
 #%post awsapi
 #if [ -d "%{_datadir}/%{name}-management" ] ; then
 #   ln -s %{_datadir}/%{name}-bridge/webapps %{_datadir}/%{name}-management/webapps7080
@@ -548,7 +541,7 @@ fi
 %attr(0755,root,root) %{_sysconfdir}/init.d/%{name}-usage
 %attr(0644,root,root) %{_datadir}/%{name}-usage/*.jar
 %attr(0644,root,root) %{_datadir}/%{name}-usage/lib/*.jar
-%dir /var/log/%{name}/usage
+%dir %attr(0770,root,cloud) %{_localstatedir}/log/%{name}/usage
 %attr(0644,root,root) %{_sysconfdir}/%{name}/usage/db.properties
 %attr(0644,root,root) %{_sysconfdir}/%{name}/usage/log4j-cloud.xml
 %{_defaultdocdir}/%{name}-usage-%{version}/LICENSE

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/574e7163/packaging/centos63/replace.properties
----------------------------------------------------------------------
diff --git a/packaging/centos63/replace.properties b/packaging/centos63/replace.properties
index 211cc95..8345854 100644
--- a/packaging/centos63/replace.properties
+++ b/packaging/centos63/replace.properties
@@ -56,5 +56,5 @@ SYSCONFDIR=/etc/sysconfig
 SYSTEMCLASSPATH=
 SYSTEMJARS=
 USAGECLASSPATH=
-USAGELOG=/var/log/cloudstack/usage
+USAGELOG=/var/log/cloudstack/usage/usage.log
 USAGESYSCONFDIR=/etc/sysconfig

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/574e7163/usage/pom.xml
----------------------------------------------------------------------
diff --git a/usage/pom.xml b/usage/pom.xml
index 37501fe..0ad59b4 100644
--- a/usage/pom.xml
+++ b/usage/pom.xml
@@ -37,6 +37,11 @@
       <version>${cs.mysql.version}</version>
       <scope>runtime</scope>
     </dependency>
+    <dependency>
+    	<groupId>commons-daemon</groupId>
+    	<artifactId>commons-daemon</artifactId>
+    	<version>1.0.10</version>
+    </dependency>
   </dependencies>
   <build>
     <defaultGoal>install</defaultGoal>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/574e7163/usage/src/com/cloud/usage/UsageServer.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/UsageServer.java b/usage/src/com/cloud/usage/UsageServer.java
index 3f2b43e..8a7c852 100644
--- a/usage/src/com/cloud/usage/UsageServer.java
+++ b/usage/src/com/cloud/usage/UsageServer.java
@@ -19,6 +19,9 @@ package com.cloud.usage;
 import java.io.File;
 import java.io.FileNotFoundException;
 
+import org.apache.commons.daemon.Daemon;
+import org.apache.commons.daemon.DaemonContext;
+import org.apache.commons.daemon.DaemonInitException;
 import org.apache.log4j.Logger;
 import org.apache.log4j.PropertyConfigurator;
 import org.apache.log4j.xml.DOMConfigurator;
@@ -29,7 +32,7 @@ import org.springframework.util.Log4jConfigurer;
 import com.cloud.utils.PropertiesUtil;
 import com.cloud.utils.component.ComponentContext;
 
-public class UsageServer {
+public class UsageServer implements Daemon {
     private static final Logger s_logger = Logger.getLogger(UsageServer.class.getName());
     public static final String Name = "usage-server";
     
@@ -39,15 +42,17 @@ public class UsageServer {
      * @param args
      */
     public static void main(String[] args) {
-    	initLog4j();
+        initLog4j();
         UsageServer usage = new UsageServer();
-        usage.init(args);
         usage.start();
     }
 
-    public void init(String[] args) {
+    @Override
+    public void init(DaemonContext arg0) throws DaemonInitException, Exception {
+        initLog4j();        
     }
 
+    @Override
     public void start() {
     	ApplicationContext appContext = new ClassPathXmlApplicationContext("usageApplicationContext.xml");
 	    
@@ -66,10 +71,12 @@ public class UsageServer {
         }
     }
 
+    @Override
     public void stop() {
 
     }
 
+    @Override
     public void destroy() {
 
     }
@@ -96,4 +103,5 @@ public class UsageServer {
 	        }
 	    }
    }
+
 }


Mime
View raw message