aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2018-05-15 13:52:47 +0200
committerDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2018-05-15 13:54:25 +0200
commit12d39d3873ced59a1b10f8ce3a7a90c33328641c (patch)
tree8480bb59ba4d7ba970ae0ef36f6ed4442c9c6f15
parentaa8d13e4fb8ea099c85969de91eff2d89190c366 (diff)
Fix log location
Fix log location so that it goes into /var/log/onap Issue-ID: CLAMP-161 Change-Id: Icec87579c7c7be8a0b4069e4152f7f964794c50c Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
-rw-r--r--src/main/java/org/onap/clamp/clds/config/spring/CldsConfiguration.java11
-rw-r--r--src/main/resources/application.properties2
-rw-r--r--src/main/resources/logback.xml23
-rw-r--r--src/main/resources/system.properties3
-rw-r--r--src/test/resources/application.properties2
5 files changed, 25 insertions, 16 deletions
diff --git a/src/main/java/org/onap/clamp/clds/config/spring/CldsConfiguration.java b/src/main/java/org/onap/clamp/clds/config/spring/CldsConfiguration.java
index 37de8330..8372e3f5 100644
--- a/src/main/java/org/onap/clamp/clds/config/spring/CldsConfiguration.java
+++ b/src/main/java/org/onap/clamp/clds/config/spring/CldsConfiguration.java
@@ -26,21 +26,28 @@ package org.onap.clamp.clds.config.spring;
import javax.sql.DataSource;
import javax.xml.transform.TransformerConfigurationException;
+import org.onap.clamp.clds.config.ClampProperties;
import org.onap.clamp.clds.config.EncodedPasswordBasicDataSource;
import org.onap.clamp.clds.dao.CldsDao;
import org.onap.clamp.clds.transform.XslTransformer;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.config.PropertiesFactoryBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
-import org.springframework.core.io.ClassPathResource;
@Configuration
@Profile("clamp-default")
public class CldsConfiguration {
+ @Autowired
+ private ApplicationContext appContext;
+ @Autowired
+ private ClampProperties refProp;
+
/**
* Clds Identity database DataSource configuration
*
@@ -55,7 +62,7 @@ public class CldsConfiguration {
@Bean(name = "mapper")
public PropertiesFactoryBean mapper() {
PropertiesFactoryBean bean = new PropertiesFactoryBean();
- bean.setLocation(new ClassPathResource("system.properties"));
+ bean.setLocation(appContext.getResource(refProp.getStringValue("files.systemProperties")));
return bean;
}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 17248182..179553dd 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -106,6 +106,8 @@ async.core.pool.size=10
async.max.pool.size=20
async.queue.capacity=500
+clamp.config.log.path=/var/log/onap
+clamp.config.files.systemProperties=classpath:/system.properties
clamp.config.files.cldsUsers=classpath:/clds/clds-users.json
clamp.config.files.globalProperties=classpath:/clds/templates/globalProperties.json
clamp.config.files.sdcController=classpath:/clds/sdc-controllers-config.json
diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml
index ef213282..22206fee 100644
--- a/src/main/resources/logback.xml
+++ b/src/main/resources/logback.xml
@@ -1,6 +1,7 @@
<configuration scan="true" scanPeriod="10 seconds" debug="false">
<jmxConfigurator />
- <property name="logDirectory" value="log" />
+ <property resource="application.properties" />
+ <property name="logDirectory" value="${clamp.config.log.path}" />
<!-- Example evaluator filter applied against console appender -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>ERROR</level>
@@ -20,7 +21,7 @@
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
- <file>${logDirectory}/CLAMP/error.log</file>
+ <file>${logDirectory}/clamp/error.log</file>
<append>true</append>
<encoder>
<pattern>%date{"yyyy-MM-dd'T'HH:mm:ss,SSSXXX", UTC}|%X{RequestId}|%.20thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode}|%X{ErrorDescription}|%msg%n</pattern>
@@ -28,7 +29,7 @@
<rollingPolicy
class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<maxIndex>10</maxIndex>
- <FileNamePattern>${logDirectory}/CLAMP/error.%i.log.zip
+ <FileNamePattern>${logDirectory}/clamp/error.%i.log.zip
</FileNamePattern>
</rollingPolicy>
<triggeringPolicy
@@ -39,13 +40,13 @@
<appender name="DEBUG"
class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${logDirectory}/CLAMP/debug.log</file>
+ <file>${logDirectory}/clamp/debug.log</file>
<append>true</append>
<encoder>
<pattern>%date{"yyyy-MM-dd'T'HH:mm:ss,SSSXXX",UTC}|%X{RequestId}|%.20thread|%.-5level|%logger{36}|%msg%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${logDirectory}/CLAMP/debug.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern>
+ <fileNamePattern>${logDirectory}/clamp/debug.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
@@ -55,7 +56,7 @@
<appender name="AUDIT"
class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${logDirectory}/CLAMP/audit.log</file>
+ <file>${logDirectory}/clamp/audit.log</file>
<append>true</append>
<encoder>
<pattern>%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%.20thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n
@@ -64,7 +65,7 @@
<rollingPolicy
class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<maxIndex>10</maxIndex>
- <FileNamePattern>${logDirectory}/CLAMP/audit.%i.log.zip
+ <FileNamePattern>${logDirectory}/clamp/audit.%i.log.zip
</FileNamePattern>
</rollingPolicy>
<triggeringPolicy
@@ -79,7 +80,7 @@
<appender name="METRIC"
class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${logDirectory}/CLAMP/metric.log</file>
+ <file>${logDirectory}/clamp/metric.log</file>
<append>true</append>
<encoder>
<pattern>%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%.20thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|
@@ -88,7 +89,7 @@
<rollingPolicy
class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<maxIndex>10</maxIndex>
- <FileNamePattern>${logDirectory}/CLAMP/metric.%i.log.zip
+ <FileNamePattern>${logDirectory}/clamp/metric.%i.log.zip
</FileNamePattern>
</rollingPolicy>
<triggeringPolicy
@@ -104,7 +105,7 @@
<!-- SECURITY related loggers -->
<appender name="SECURITY"
class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${logDirectory}/CLAMP/security.log</file>
+ <file>${logDirectory}/clamp/security.log</file>
<append>true</append>
<encoder>
<pattern>%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%.20thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n
@@ -113,7 +114,7 @@
<rollingPolicy
class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<maxIndex>10</maxIndex>
- <FileNamePattern>${logDirectory}/CLAMP/security.%i.log.zip
+ <FileNamePattern>${logDirectory}/clamp/security.%i.log.zip
</FileNamePattern>
</rollingPolicy>
<triggeringPolicy
diff --git a/src/main/resources/system.properties b/src/main/resources/system.properties
index 5f6e217d..0ecba955 100644
--- a/src/main/resources/system.properties
+++ b/src/main/resources/system.properties
@@ -21,14 +21,11 @@
#
###
-# If the environment property system_properties_path contains a path to a file , System properties created using the file. If the environment variable not present, system.properties in the class path is used for system property creation
-
com.att.eelf.logging.file=classpath:/logback.xml
# change as per logback.xml path
com.att.eelf.logging.path=./
logging.config=classpath:/logback.xml
-
#
# JVM SSL/TLS properties
jdk.tls.client.protocols=TLSv1.1,TLSv1.2
diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties
index b543af18..7d6ba511 100644
--- a/src/test/resources/application.properties
+++ b/src/test/resources/application.properties
@@ -106,6 +106,8 @@ async.core.pool.size=10
async.max.pool.size=20
async.queue.capacity=500
+clamp.config.log.path=log
+clamp.config.files.systemProperties=classpath:/system.properties
clamp.config.files.cldsUsers=classpath:/clds/clds-users.json
clamp.config.files.globalProperties=classpath:/clds/templates/globalProperties.json
clamp.config.files.sdcController=classpath:/clds/sdc-controllers-config.json