mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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.
This commit is contained in:
parent
32c7e1d880
commit
574e716352
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -41,13 +44,15 @@ public class UsageServer {
|
||||
public static void main(String[] args) {
|
||||
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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user