ONAP log files consolidation

Check in changes for pap,pdp,console,brmsgw,paplp and pdplp

Change-Id: I23525a44e0f269d04d9870c3eed18b6b8daacb2c
Issue-ID: POLICY-562
Signed-off-by: Chou, Joseph (JC2555) <jc2555@att.com>
diff --git a/BRMSGateway/src/main/resources/log4j.properties b/BRMSGateway/src/main/resources/log4j.properties
index 9ec89ea..8be1ea1 100644
--- a/BRMSGateway/src/main/resources/log4j.properties
+++ b/BRMSGateway/src/main/resources/log4j.properties
@@ -29,7 +29,7 @@
 log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender
 
 # Set the name of the file
-log4j.appender.FILE.File=BRMSLog.log
+log4j.appender.FILE.File=${POLICY_LOGS}/policy/brmsgw/BRMSLog.log
 
 # Set the immediate flush to true (default)
 log4j.appender.FILE.ImmediateFlush=true
diff --git a/BRMSGateway/src/main/resources/logback.xml b/BRMSGateway/src/main/resources/logback.xml
index c01117b..2d592c0 100644
--- a/BRMSGateway/src/main/resources/logback.xml
+++ b/BRMSGateway/src/main/resources/logback.xml
@@ -21,15 +21,15 @@
 <configuration scan="true" scanPeriod="3 seconds" debug="true">
   <!--<jmxConfigurator /> -->
   <!-- directory path for all other type logs -->
-  <property name="logDir" value="logs" />
+  <property name="logDir" value="${POLICY_LOGS}" />
   
   <!-- directory path for debugging type logs -->
-  <property name="debugDir" value="logs" />
+  <property name="debugDir" value="${POLICY_LOGS}" />
   
   <!--  specify the component name 
     <ONAP-component-name>::= "MSO" | "DCAE" | "ASDC " | "AAI" |"Policy" | "SDNC" | "AC"  -->
-  <property name="componentName" value="Policy"></property>
-  <property name="subComponentName" value="BRMSGateway"></property>
+  <property name="componentName" value="policy"></property>
+  <property name="subComponentName" value="brmsgw"></property>
   
   <!--  log file names -->
   <property name="errorLogName" value="error" />
diff --git a/ONAP-PAP-REST/src/main/resources/log4j.properties b/ONAP-PAP-REST/src/main/resources/log4j.properties
index 04f3233..d728f2d 100644
--- a/ONAP-PAP-REST/src/main/resources/log4j.properties
+++ b/ONAP-PAP-REST/src/main/resources/log4j.properties
@@ -28,7 +28,7 @@
 
 # FILE appender
 log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.FILE.File=${catalina.base}/logs/pap-rest.log
+log4j.appender.FILE.File=${POLICY_LOGS}/policy/pap/pap-rest.log
 log4j.appender.FILE.ImmediateFlush=true
 log4j.appender.FILE.Threshold=debug
 log4j.appender.FILE.append=true
@@ -47,7 +47,7 @@
 log4j.logger.xacml.request=INFO, REQUEST_LOG
 
 log4j.appender.REQUEST_LOG=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.REQUEST_LOG.File=${catalina.base}/logs/pap-rest-reqres.log
+log4j.appender.REQUEST_LOG.File=${POLICY_LOGS}/policy/pap/pap-rest-reqres.log
 log4j.appender.REQUEST_LOG.ImmediateFlush=true
 log4j.appender.REQUEST_LOG.Threshold=debug
 log4j.appender.REQUEST_LOG.append=true
@@ -63,7 +63,7 @@
 log4j.additivity.auditLogger=false
 
 log4j.appender.AUDIT_LOG=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.AUDIT_LOG.File=${catalina.base}/logs/audit.log
+log4j.appender.AUDIT_LOG.File=${POLICY_LOGS}/policy/pap/audit.log
 log4j.appender.AUDIT_LOG.Append=true
 log4j.appender.AUDIT_LOG.DatePattern='.'yyyy-MM-dd
 log4j.appender.AUDIT_LOG.threshold=INFO
diff --git a/ONAP-PAP-REST/src/main/resources/logback.xml b/ONAP-PAP-REST/src/main/resources/logback.xml
index 3595b24..24afa55 100644
--- a/ONAP-PAP-REST/src/main/resources/logback.xml
+++ b/ONAP-PAP-REST/src/main/resources/logback.xml
@@ -21,15 +21,15 @@
 <configuration scan="true" scanPeriod="3 seconds" debug="true">
   <!--<jmxConfigurator /> -->
   <!-- directory path for all other type logs -->
-  <property name="logDir" value="logs" />
+  <property name="logDir" value="${POLICY_LOGS}" />
   
   <!-- directory path for debugging type logs -->
-  <property name="debugDir" value="logs" />
+  <property name="debugDir" value="${POLICY_LOGS}" />
   
   <!--  specify the component name 
     <ONAP-component-name>::= "MSO" | "DCAE" | "ASDC " | "AAI" |"Policy" | "SDNC" | "AC"  -->
-  <property name="componentName" value="Policy"></property>
-  <property name="subComponentName" value="ONAP-PAP-REST"></property>
+  <property name="componentName" value="policy"></property>
+  <property name="subComponentName" value="pap"></property>
   
   <!--  log file names -->
   <property name="errorLogName" value="error" />
@@ -84,8 +84,8 @@
           <property name="debugLogDirectory" value="${debugDir}/${componentName}/${subComponentName}" />
 
    -->   
-   <property name="logDirectory" value="${catalina.base}/${logDir}/${componentName}/${subComponentName}" />
-   <property name="debugLogDirectory" value="${catalina.base}/${debugDir}/${componentName}/${subComponentName}" />
+   <property name="logDirectory" value="${logDir}/${componentName}/${subComponentName}" />
+   <property name="debugLogDirectory" value="${debugDir}/${componentName}/${subComponentName}" />
    
 
  
diff --git a/ONAP-PDP-REST/src/main/resources/log4j.properties b/ONAP-PDP-REST/src/main/resources/log4j.properties
index 6e5cfac..925d2ea 100644
--- a/ONAP-PDP-REST/src/main/resources/log4j.properties
+++ b/ONAP-PDP-REST/src/main/resources/log4j.properties
@@ -28,7 +28,7 @@
 
 # FILE appender
 log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.FILE.File=${catalina.base}/logs/pdp-rest.log
+log4j.appender.FILE.File=${POLICY_LOGS}/policy/pdpx/pdp-rest.log
 log4j.appender.FILE.ImmediateFlush=true
 log4j.appender.FILE.Threshold=debug
 log4j.appender.FILE.append=true
@@ -47,7 +47,7 @@
 log4j.logger.xacml.request=INFO, REQUEST_LOG
 
 log4j.appender.REQUEST_LOG=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.REQUEST_LOG.File=${catalina.base}/logs/pdp-rest-reqres.log
+log4j.appender.REQUEST_LOG.File=${POLICY_LOGS}/policy/pdpx/pdp-rest-reqres.log
 log4j.appender.REQUEST_LOG.ImmediateFlush=true
 log4j.appender.REQUEST_LOG.Threshold=debug
 log4j.appender.REQUEST_LOG.append=true
@@ -63,7 +63,7 @@
 log4j.additivity.auditLogger=false
 
 log4j.appender.AUDIT_LOG=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.AUDIT_LOG.File=${catalina.base}/logs/audit.log
+log4j.appender.AUDIT_LOG.File=${POLICY_LOGS}/policy/pdpx/audit.log
 log4j.appender.AUDIT_LOG.Append=true
 log4j.appender.AUDIT_LOG.DatePattern='.'yyyy-MM-dd
 log4j.appender.AUDIT_LOG.threshold=INFO
diff --git a/ONAP-PDP-REST/src/main/resources/logback.xml b/ONAP-PDP-REST/src/main/resources/logback.xml
index 677b0d0..abcebff 100644
--- a/ONAP-PDP-REST/src/main/resources/logback.xml
+++ b/ONAP-PDP-REST/src/main/resources/logback.xml
@@ -21,15 +21,15 @@
 <configuration scan="true" scanPeriod="3 seconds" debug="true">
   <!--<jmxConfigurator /> -->
   <!-- directory path for all other type logs -->
-  <property name="logDir" value="logs" />
+  <property name="logDir" value="${POLICY_LOGS}" />
   
   <!-- directory path for debugging type logs -->
-  <property name="debugDir" value="logs" />
+  <property name="debugDir" value="${POLICY_LOGS}" />
   
   <!--  specify the component name 
     <ONAP-component-name>::= "MSO" | "DCAE" | "ASDC " | "AAI" |"Policy" | "SDNC" | "AC"  -->
-  <property name="componentName" value="Policy"></property>
-  <property name="subComponentName" value="ONAP-PDP-REST"></property>
+  <property name="componentName" value="policy"></property>
+  <property name="subComponentName" value="pdpx"></property>
   
   <!--  log file names -->
   <property name="errorLogName" value="error" />
@@ -83,8 +83,8 @@
           <property name="debugLogDirectory" value="${debugDir}/${componentName}/${subComponentName}" />
 
    -->   
-   <property name="logDirectory" value="${catalina.base}/${logDir}/${componentName}/${subComponentName}" />
-   <property name="debugLogDirectory" value="${catalina.base}/${debugDir}/${componentName}/${subComponentName}" />
+   <property name="logDirectory" value="${logDir}/${componentName}/${subComponentName}" />
+   <property name="debugLogDirectory" value="${debugDir}/${componentName}/${subComponentName}" />
    
 
  
diff --git a/ONAP-PDP/logging.properties b/ONAP-PDP/logging.properties
index d25697e..900d3ad 100644
--- a/ONAP-PDP/logging.properties
+++ b/ONAP-PDP/logging.properties
@@ -24,6 +24,6 @@
 
 java.util.logging.ConsoleHandler.level = INFO
 java.util.logging.FileHandler.level = INFO
-java.util.logging.FileHandler.pattern=%h/xacml_log%u.log
+java.util.logging.FileHandler.pattern=${POLICY_LOGS}/policy/pdpx/%h/xacml_log%u.log
 java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
 java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
diff --git a/ONAP-SDK-APP/src/main/resources/logback.xml b/ONAP-SDK-APP/src/main/resources/logback.xml
index d19b1ba..134ecb8 100644
--- a/ONAP-SDK-APP/src/main/resources/logback.xml
+++ b/ONAP-SDK-APP/src/main/resources/logback.xml
@@ -28,15 +28,16 @@
   <!--<jmxConfigurator /> -->
 
   <!--  specify the component name -->
-  <property name="componentName" value="epsdk_app_os"></property>
+  <property name="componentName" value="policy"></property>
+  <property name="subComponentName" value="console"></property>
   
   <!--  specify the base path of the log directory -->
-  <property name="logDirPrefix" value="${catalina.base}/logs"></property>
+  <property name="logDirPrefix" value="${POLICY_LOGS}"></property>
   
   <!-- The directories where logs are written -->
-  <property name="logDirectory" value="${logDirPrefix}/${componentName}" />
+  <property name="logDirectory" value="${logDirPrefix}/${componentName}/${subComponentName}" />
   <!-- Can easily relocate debug logs by modifying this path. -->
-  <property name="debugLogDirectory" value="${logDirPrefix}/${componentName}" />
+  <property name="debugLogDirectory" value="${logDirPrefix}/${componentName}/${subComponentName}" />
   
   <!--  log file names -->
   <property name="generalLogName" value="application" />
@@ -234,4 +235,4 @@
     <appender-ref ref="asyncEELF" />
   </root>
 
-</configuration>
+</configuration>
\ No newline at end of file
diff --git a/PolicyEngineAPI/src/main/resources/log4j.properties b/PolicyEngineAPI/src/main/resources/log4j.properties
index 83a68a7..d6787bd 100644
--- a/PolicyEngineAPI/src/main/resources/log4j.properties
+++ b/PolicyEngineAPI/src/main/resources/log4j.properties
@@ -29,7 +29,7 @@
 log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender
 
 # Set the name of the file
-log4j.appender.FILE.File=policyEngineLog.log
+log4j.appender.FILE.File=${POLICY_LOGS}/policy/engineapi/policyEngineLog.log
 
 # Set the immediate flush to true (default)
 log4j.appender.FILE.ImmediateFlush=true
@@ -48,9 +48,9 @@
 log4j.appender.FILE.layout.ConversionPattern=%d{yyyy_MM_dd_HH_mm_ss_SSS} [%t] %-5p %l- %m%n
 
 # For AstraGW feature. 
-log4j.appender.astra=org.apache.log4j.FileAppender
-log4j.appender.astra.File=astragw.log
-log4j.appender.astra.layout=org.apache.log4j.PatternLayout
-log4j.appender.astra.layout.ConversionPattern=%d{yyyy_MM_dd_HH_mm_ss_SSS} [%t] %-5p %l- %m%n
-log4j.category.astraLogger=TRACE, astra
-log4j.additivity.astraLogger=false
+#log4j.appender.astra=org.apache.log4j.FileAppender
+#log4j.appender.astra.File=${POLICY_LOGS}/policy/astragw/astragw.log
+#log4j.appender.astra.layout=org.apache.log4j.PatternLayout
+#log4j.appender.astra.layout.ConversionPattern=%d{yyyy_MM_dd_HH_mm_ss_SSS} [%t] %-5p %l- %m%n
+#log4j.category.astraLogger=TRACE, astra
+#log4j.additivity.astraLogger=false
diff --git a/PolicyEngineAPI/src/main/resources/logback.xml b/PolicyEngineAPI/src/main/resources/logback.xml
index 347466b..37261ed 100644
--- a/PolicyEngineAPI/src/main/resources/logback.xml
+++ b/PolicyEngineAPI/src/main/resources/logback.xml
@@ -21,15 +21,15 @@
 <configuration scan="true" scanPeriod="3 seconds" debug="true">
   <!--<jmxConfigurator /> -->
   <!-- directory path for all other type logs -->
-  <property name="logDir" value="logs" />
+  <property name="logDir" value="${POLICY_LOGS}" />
   
   <!-- directory path for debugging type logs -->
-  <property name="debugDir" value="logs" />
+  <property name="debugDir" value="${POLICY_LOGS}" />
   
   <!--  specify the component name 
     <ONAP-component-name>::= "MSO" | "DCAE" | "ASDC " | "AAI" |"Policy" | "SDNC" | "AC"  -->
-  <property name="componentName" value="Policy"></property>
-  <property name="subComponentName" value="PolicyEngineAPI"></property>
+  <property name="componentName" value="policy"></property>
+  <property name="subComponentName" value="policyapi"></property>
   
   <!--  log file names -->
   <property name="errorLogName" value="error" />
diff --git a/packages/base/src/files/etc/profile.d/env.sh b/packages/base/src/files/etc/profile.d/env.sh
index 56b4426..2484bbc 100644
--- a/packages/base/src/files/etc/profile.d/env.sh
+++ b/packages/base/src/files/etc/profile.d/env.sh
@@ -21,6 +21,7 @@
 export POLICY_HOME=${{POLICY_HOME}}
 export POLICY_USER=${{POLICY_USER}}
 export POLICY_GROUP=${{POLICY_GROUP}}
+export POLICY_LOGS=${{POLICY_LOGS}}
 export KEYSTORE_PASSWD=${{KEYSTORE_PASSWD}}
 
 export JAVA_HOME=${{JAVA_HOME}}
diff --git a/packages/base/src/files/install/mysql/bin/cleanup_policy.sh b/packages/base/src/files/install/mysql/bin/cleanup_policy.sh
index 1841d3c..8220705 100644
--- a/packages/base/src/files/install/mysql/bin/cleanup_policy.sh
+++ b/packages/base/src/files/install/mysql/bin/cleanup_policy.sh
@@ -71,8 +71,12 @@
 }
 
 # MAIN
-LOG=$POLICY_HOME/logs/cleanup_policy_$DATE.log
-ERR=$POLICY_HOME/logs/cleanup_policy_$DATE.err
+if [ -z ${POLICY_LOGS} ]; then
+  POLICY_LOGS=/var/log/onap
+fi
+mkdir -p $POLICY_LOGS/policy/db
+LOG=$POLICY_LOGS/policy/db/cleanup_policy_$DATE.log
+ERR=$POLICY_LOGS/policy/db/cleanup_policy_$DATE.err
 echo "cleanup_policy.sh started ... `date`" | tee -a $LOG
 if [ $# -eq 3 ]; then 
   DB_USER="${1}"
@@ -88,5 +92,4 @@
 else
   echo "Usage  : cleanup_policy.sh db_user_id  db_user_password retention_period" 
   echo "Example: cleanup_policy.sh policy_user password         90" 
-fi
-
+fi
\ No newline at end of file
diff --git a/packages/base/src/files/install/mysql/bin/db_backup.sh b/packages/base/src/files/install/mysql/bin/db_backup.sh
index dca2017..1f62f73 100644
--- a/packages/base/src/files/install/mysql/bin/db_backup.sh
+++ b/packages/base/src/files/install/mysql/bin/db_backup.sh
@@ -63,6 +63,12 @@
 
 
 # MAIN
+if [ -z ${POLICY_LOGS} ]; then
+  POLICY_LOGS=/var/log/onap
+fi
+mkdir -p $POLICY_LOGS/policy/db
+LOG=$POLICY_LOGS/policy/db/db_backup_$DATE.log
+ERR=$POLICY_LOGS/policy/db/db_backup_$DATE.err  
 echo "db_backup.sh started ... `date`" | tee -a $LOG
 if [ $# -eq 3 ]; then 
   DB_USER="${1}"
@@ -71,8 +77,6 @@
   echo "DB_USER: $DB_USER" | tee -a $LOG
     
   DAILY_BACKUP_DIR=$POLICY_HOME/data/mysql/$DATE
-  LOG=$POLICY_HOME/logs/db_backup_$DATE.log
-  ERR=$POLICY_HOME/logs/db_backup_$DATE.err
   create_backup_dir 
 
   backup_database
@@ -80,5 +84,4 @@
 else
   echo "Usage  : db_backup.sh db_user_id  db_user_password database" 
   echo "Example: db_backup.sh policy_user password         onap_sdk" 
-fi
-
+fi
\ No newline at end of file
diff --git a/packages/base/src/files/install/mysql/bin/db_backup_data.sh b/packages/base/src/files/install/mysql/bin/db_backup_data.sh
index ee0b447..53710af 100644
--- a/packages/base/src/files/install/mysql/bin/db_backup_data.sh
+++ b/packages/base/src/files/install/mysql/bin/db_backup_data.sh
@@ -63,8 +63,12 @@
 
 
 # MAIN
-LOG=$POLICY_HOME/logs/db_backup_data_$DATE.log
-ERR=$POLICY_HOME/logs/db_backup_data_$DATE.err
+if [ -z ${POLICY_LOGS} ]; then
+  POLICY_LOGS=/var/log/onap
+fi
+mkdir -p $POLICY_LOGS/onap/policy/db
+LOG=$POLICY_LOGS/policy/db/db_backup_data_$DATE.log
+ERR=$POLICY_LOGS/policy/db/db_backup_data_$DATE.err
 echo "db_backup_data.sh started ... `date`" | tee -a $LOG
 if [ $# -eq 3 ]; then 
   DB_USER="${1}"
@@ -80,5 +84,4 @@
 else
   echo "Usage  : db_backup_data.sh db_user_id  db_user_password database" 
   echo "Example: db_backup_data.sh policy_user password         xacml" 
-fi
-
+fi
\ No newline at end of file
diff --git a/packages/base/src/files/install/mysql/bin/db_backup_remote.sh b/packages/base/src/files/install/mysql/bin/db_backup_remote.sh
index 2128969..72f31c3 100644
--- a/packages/base/src/files/install/mysql/bin/db_backup_remote.sh
+++ b/packages/base/src/files/install/mysql/bin/db_backup_remote.sh
@@ -70,14 +70,19 @@
   DB_PASSWORD="${2}"
   DATABASE="${3}"
   DB_HOSTNAME="${4}"
+  if [ -z ${POLICY_LOGS} ]; then
+    POLICY_LOGS=/var/log/onap
+  fi
+  mkdir -p $POLICY_LOGS/policy/db
+  LOG=$POLICY_LOGS/policy/db/db_backup_remote_$DATE.log
+  ERR=$POLICY_LOGS/policy/db/db_backup_remote_$DATE.err
+
   echo "db_backup_remote.sh for [$DATABASE]@[${DB_HOSTNAME}] started ... `date`" | tee -a $LOG
   echo "DB_USER    : $DB_USER"     | tee -a $LOG
   echo "DATABASE   : $DATABASE"    | tee -a $LOG
   echo "DB_HOSTNAME: $DB_HOSTNAME" | tee -a $LOG
     
   DAILY_BACKUP_DIR=$POLICY_HOME/data/mysql/$DATE
-  LOG=$POLICY_HOME/logs/db_backup_remote_$DATE.log
-  ERR=$POLICY_HOME/logs/db_backup_remote_$DATE.err
   create_backup_dir 
 
   backup_database
diff --git a/packages/base/src/files/install/mysql/bin/db_restore.sh b/packages/base/src/files/install/mysql/bin/db_restore.sh
index 0f63535..765b0ca 100644
--- a/packages/base/src/files/install/mysql/bin/db_restore.sh
+++ b/packages/base/src/files/install/mysql/bin/db_restore.sh
@@ -38,6 +38,8 @@
 DATABASE=""
 TABLE=""
 TEMP_FILE=/tmp/db_restore_$$.sql
+DATE=`date +"%Y%m%d"`
+LOG=""
 
 function restore_all
 {
@@ -54,7 +56,7 @@
 {
   database="${1}"
   table="${2}"
-  echo "restore_table [$database] [$table] started ...@`date`"
+  echo "restore_table [$database] [$table] started ...@`date`" | tee -a $LOG
   # extract sql statement from backup file
   echo "use $database;" > $TEMP_FILE 
   echo "set foreign_key_checks=0; " >> $TEMP_FILE
@@ -66,12 +68,18 @@
   echo "Before restore table ..." | tee -a $LOG
   mysql -u${DB_USER} -p${DB_PASSWORD} < $TEMP_FILE 
   echo "--" 
-  echo "restore_table [$database] [$table] completed ...@`date`"
+  echo "restore_table [$database] [$table] completed ...@`date`" | tee -a $LOG
 }
 
 
 # MAIN
-echo "db_restore.sh started ... `date`"
+if [ -z ${POLICY_LOGS} ]; then
+  POLICY_LOGS=/var/log/onap
+fi
+mkdir -p $POLICY_LOGS/policy/db
+LOG=$POLICY_LOGS/policy/db/db_restore_$DATE.log
+  
+echo "db_restore.sh started ... `date`" | tee -a $LOG
 if [ $# -eq 5 ]; then 
   DB_USER="${1}"
   DB_PASSWORD="${2}"
@@ -86,7 +94,7 @@
       restore_all
     fi
   else
-    echo "BACKUP FILE NOT FOUND: $BACKUP_FILE"
+    echo "BACKUP FILE NOT FOUND: $BACKUP_FILE" | tee -a $LOG
   fi
 else
   echo "Usage  : db_restore.sh db_user_id  db_password  backup_file database table_name" 
@@ -94,4 +102,4 @@
 fi
 
 rm -f $TEMP_FILE
-echo "db_restore.sh completed ... `date`"
+echo "db_restore.sh completed ... `date`" | tee -a $LOG
diff --git a/packages/base/src/files/install/mysql/bin/db_restore_data.sh b/packages/base/src/files/install/mysql/bin/db_restore_data.sh
index c4fec02..ec0874a 100644
--- a/packages/base/src/files/install/mysql/bin/db_restore_data.sh
+++ b/packages/base/src/files/install/mysql/bin/db_restore_data.sh
@@ -40,6 +40,8 @@
 DATABASE=""
 TABLE=""
 TEMP_FILE=/tmp/db_restore_data_$$.sql
+DATE=`date +"%Y%m%d"`
+LOG=""
 
 function restore_all
 {
@@ -85,6 +87,11 @@
   typeset -l DATABASE="${4}"
   typeset -l TABLE="${5}"
   echo "DB_USER: $DB_USER" 
+  if [ -z ${POLICY_LOGS} ]; then
+    POLICY_LOGS=/var/log/onap
+  fi
+  mkdir -p $POLICY_LOGS/policy/db
+  LOG=$POLICY_LOGS/policy/db/db_restore_data_$DATE.log
   if [ -f $BACKUP_FILE ]; then 
     if [ "${TABLE}" != "all" ]; then 
       restore_table ${DATABASE} ${TABLE}
diff --git a/packages/base/src/files/install/mysql/bin/db_upgrade.sh b/packages/base/src/files/install/mysql/bin/db_upgrade.sh
index 87d5d9b..85a9218 100644
--- a/packages/base/src/files/install/mysql/bin/db_upgrade.sh
+++ b/packages/base/src/files/install/mysql/bin/db_upgrade.sh
@@ -124,8 +124,12 @@
 
 # MAIN
 #check_directory
-LOG=$POLICY_HOME/logs/db_upgrade_$DATE.log
-ERR=$POLICY_HOME/logs/db_upgrade_$DATE.err
+if [ -z ${POLICY_LOGS} ]; then
+  POLICY_LOGS=/var/log/onap
+fi
+mkdir -p $POLICY_LOGS/policy/db
+LOG=$POLICY_LOGS/policy/db/db_upgrade_$DATE.log
+ERR=$POLICY_LOGS/policy/db/db_upgrade_$DATE.err
 echo "db_upgrade.sh started ..." | tee -a $LOG
 if [ $# -eq 3 ]; then 
   TARGET_RELEASE="${1}"
diff --git a/packages/base/src/files/install/mysql/bin/db_upgrade_remote.sh b/packages/base/src/files/install/mysql/bin/db_upgrade_remote.sh
index a10ac21..c431681 100644
--- a/packages/base/src/files/install/mysql/bin/db_upgrade_remote.sh
+++ b/packages/base/src/files/install/mysql/bin/db_upgrade_remote.sh
@@ -146,8 +146,12 @@
 
 # MAIN
 #check_directory
-LOG=$POLICY_HOME/logs/db_upgrade_remote_$DATE.log
-ERR=$POLICY_HOME/logs/db_upgrade_remote_$DATE.err
+if [ -z ${POLICY_LOGS} ]; then
+  POLICY_LOGS=/var/log/onap
+fi
+mkdir -p $POLICY_LOGS/policy/db
+LOG=$POLICY_LOGS/policy/db/db_upgrade_remote_$DATE.log
+ERR=$POLICY_LOGS/policy/db/db_upgrade_remote_$DATE.err
 echo "db_upgrade_remote.sh started ..." | tee -a $LOG
 if [ $# -eq 3 ]; then 
   DB_UPGRADE_USER="${1}"
diff --git a/packages/base/src/files/install/servers/brmsgw/init.d/brmsgw b/packages/base/src/files/install/servers/brmsgw/init.d/brmsgw
index c3b406b..998a369 100644
--- a/packages/base/src/files/install/servers/brmsgw/init.d/brmsgw
+++ b/packages/base/src/files/install/servers/brmsgw/init.d/brmsgw
@@ -48,7 +48,7 @@
 	JAVA_OPTS=("${JVM_JAVA_OPTS[@]}" "${JMX_JAVA_OPTS[@]}" "${JVM_SECURITY[@]}") 
  
 	cd $POLICY_HOME/servers/brmsgw
-	nohup $JAVA_HOME/bin/java -jar "${JAVA_OPTS[@]}" $POLICY_HOME/servers/brmsgw/BRMSGateway.jar>> $POLICY_HOME/logs/brmsgw.log 2>&1 &
+	nohup $JAVA_HOME/bin/java -jar "${JAVA_OPTS[@]}" $POLICY_HOME/servers/brmsgw/BRMSGateway.jar>> $POLICY_LOGS/policy/brmsgw/brmsgw.log 2>&1 &
 	RETVAL=$?
 }
 
diff --git a/packages/base/src/files/install/servers/common/logparser/init.d/logparserd b/packages/base/src/files/install/servers/common/logparser/init.d/logparserd
index 37221b9..e4ad903 100755
--- a/packages/base/src/files/install/servers/common/logparser/init.d/logparserd
+++ b/packages/base/src/files/install/servers/common/logparser/init.d/logparserd
@@ -25,7 +25,7 @@
 	
 	# Redirects default and error output to a log file
 	cd ${POLICY_HOME}/servers/${COMPONENT}/bin
-	nohup $JAVA_HOME/bin/java -jar ${JAVA_OPTS} ${SERVICE} ${SERVER} ${LOGTYPE} >> ${POLICY_HOME}/servers/${COMPONENT}/logs/stdout 2>&1 &
+	nohup $JAVA_HOME/bin/java -jar ${JAVA_OPTS} ${SERVICE} ${SERVER} ${LOGTYPE} >> ${POLICY_LOG}/policy/${COMPONENT}/stdout 2>&1 &
 RETVAL=$?
 	RETVAL=$?	
 }
diff --git a/packages/base/src/files/install/servers/common/tomcat/conf/server.xml b/packages/base/src/files/install/servers/common/tomcat/conf/server.xml
index 7873472..a78dfc8 100644
--- a/packages/base/src/files/install/servers/common/tomcat/conf/server.xml
+++ b/packages/base/src/files/install/servers/common/tomcat/conf/server.xml
@@ -157,7 +157,7 @@
         <!-- Access log processes all example.
              Documentation at: /docs/config/valve.html
              Note: The pattern used is equivalent to using pattern="common" -->
-        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
+        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="${{POLICY_LOGS}}/policy/catalina"
                prefix="localhost_access_log" suffix=".txt"
                pattern="%h %l %u %t &quot;%r&quot; %s %b" />
 
diff --git a/packages/base/src/files/install/servers/configs/conf/server.xml b/packages/base/src/files/install/servers/configs/conf/server.xml
index 2a6191e..ecbeb6e 100644
--- a/packages/base/src/files/install/servers/configs/conf/server.xml
+++ b/packages/base/src/files/install/servers/configs/conf/server.xml
@@ -159,7 +159,7 @@
         <!-- Access log processes all example.
              Documentation at: /docs/config/valve.html
              Note: The pattern used is equivalent to using pattern="common" -->
-        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
+        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="${{POLICY_LOGS}}/policy/catalina"
                prefix="localhost_access_log" suffix=".txt"
                pattern="%h %l %u %t &quot;%r&quot; %s %b" />
 
diff --git a/packages/base/src/files/install/servers/console/conf/logging.properties b/packages/base/src/files/install/servers/console/conf/logging.properties
new file mode 100644
index 0000000..88e50c5
--- /dev/null
+++ b/packages/base/src/files/install/servers/console/conf/logging.properties
@@ -0,0 +1,65 @@
+# 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.
+
+handlers = 1catalina.org.apache.juli.AsyncFileHandler, 2localhost.org.apache.juli.AsyncFileHandler, 3manager.org.apache.juli.AsyncFileHandler, 4host-manager.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler
+
+.handlers = 1catalina.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+1catalina.org.apache.juli.AsyncFileHandler.level = FINE
+1catalina.org.apache.juli.AsyncFileHandler.directory = /var/log/onap/policy/console
+1catalina.org.apache.juli.AsyncFileHandler.prefix = catalina.
+
+2localhost.org.apache.juli.AsyncFileHandler.level = FINE
+2localhost.org.apache.juli.AsyncFileHandler.directory = /var/log/onap/policy/console
+2localhost.org.apache.juli.AsyncFileHandler.prefix = localhost.
+
+3manager.org.apache.juli.AsyncFileHandler.level = FINE
+3manager.org.apache.juli.AsyncFileHandler.directory = /var/log/onap/policy/console
+3manager.org.apache.juli.AsyncFileHandler.prefix = manager.
+
+4host-manager.org.apache.juli.AsyncFileHandler.level = FINE
+4host-manager.org.apache.juli.AsyncFileHandler.directory = /var/log/onap/policy/console
+4host-manager.org.apache.juli.AsyncFileHandler.prefix = host-manager.
+
+java.util.logging.ConsoleHandler.level = FINE
+java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter
+
+
+############################################################
+# Facility specific properties.
+# Provides extra control for each logger.
+############################################################
+
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.AsyncFileHandler
+
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.AsyncFileHandler
+
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 4host-manager.org.apache.juli.AsyncFileHandler
+
+# For example, set the org.apache.catalina.util.LifecycleBase logger to log
+# each component that extends LifecycleBase changing state:
+#org.apache.catalina.util.LifecycleBase.level = FINE
+
+# To see debug messages in TldLocationsCache, uncomment the following line:
+#org.apache.jasper.compiler.TldLocationsCache.level = FINE
+
diff --git a/packages/base/src/files/install/servers/console/conf/server.xml b/packages/base/src/files/install/servers/console/conf/server.xml
index 53d563b..618a6a9 100644
--- a/packages/base/src/files/install/servers/console/conf/server.xml
+++ b/packages/base/src/files/install/servers/console/conf/server.xml
@@ -162,7 +162,7 @@
         <!-- Access log processes all example.
              Documentation at: /docs/config/valve.html
              Note: The pattern used is equivalent to using pattern="common" -->
-        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
+        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="${{POLICY_LOGS}}/policy/catalina"
                prefix="localhost_access_log" suffix=".txt"
                pattern="%h %l %u %t &quot;%r&quot; %s %b" />
 
diff --git a/packages/base/src/files/install/servers/pap/conf/logging.properties b/packages/base/src/files/install/servers/pap/conf/logging.properties
new file mode 100644
index 0000000..3d4d024
--- /dev/null
+++ b/packages/base/src/files/install/servers/pap/conf/logging.properties
@@ -0,0 +1,65 @@
+# 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.
+
+handlers = 1catalina.org.apache.juli.AsyncFileHandler, 2localhost.org.apache.juli.AsyncFileHandler, 3manager.org.apache.juli.AsyncFileHandler, 4host-manager.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler
+
+.handlers = 1catalina.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+1catalina.org.apache.juli.AsyncFileHandler.level = FINE
+1catalina.org.apache.juli.AsyncFileHandler.directory = /var/log/onap/policy/pap
+1catalina.org.apache.juli.AsyncFileHandler.prefix = catalina.
+
+2localhost.org.apache.juli.AsyncFileHandler.level = FINE
+2localhost.org.apache.juli.AsyncFileHandler.directory = /var/log/onap/policy/pap
+2localhost.org.apache.juli.AsyncFileHandler.prefix = localhost.
+
+3manager.org.apache.juli.AsyncFileHandler.level = FINE
+3manager.org.apache.juli.AsyncFileHandler.directory = /var/log/onap/policy/pap
+3manager.org.apache.juli.AsyncFileHandler.prefix = manager.
+
+4host-manager.org.apache.juli.AsyncFileHandler.level = FINE
+4host-manager.org.apache.juli.AsyncFileHandler.directory = /var/log/onap/policy/pap
+4host-manager.org.apache.juli.AsyncFileHandler.prefix = host-manager.
+
+java.util.logging.ConsoleHandler.level = FINE
+java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter
+
+
+############################################################
+# Facility specific properties.
+# Provides extra control for each logger.
+############################################################
+
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.AsyncFileHandler
+
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.AsyncFileHandler
+
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 4host-manager.org.apache.juli.AsyncFileHandler
+
+# For example, set the org.apache.catalina.util.LifecycleBase logger to log
+# each component that extends LifecycleBase changing state:
+#org.apache.catalina.util.LifecycleBase.level = FINE
+
+# To see debug messages in TldLocationsCache, uncomment the following line:
+#org.apache.jasper.compiler.TldLocationsCache.level = FINE
+
diff --git a/packages/base/src/files/install/servers/pdp/conf/logging.properties b/packages/base/src/files/install/servers/pdp/conf/logging.properties
new file mode 100644
index 0000000..1f8e48d
--- /dev/null
+++ b/packages/base/src/files/install/servers/pdp/conf/logging.properties
@@ -0,0 +1,65 @@
+# 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.
+
+handlers = 1catalina.org.apache.juli.AsyncFileHandler, 2localhost.org.apache.juli.AsyncFileHandler, 3manager.org.apache.juli.AsyncFileHandler, 4host-manager.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler
+
+.handlers = 1catalina.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+1catalina.org.apache.juli.AsyncFileHandler.level = FINE
+1catalina.org.apache.juli.AsyncFileHandler.directory = /var/log/onap/policy/pdp
+1catalina.org.apache.juli.AsyncFileHandler.prefix = catalina.
+
+2localhost.org.apache.juli.AsyncFileHandler.level = FINE
+2localhost.org.apache.juli.AsyncFileHandler.directory = /var/log/onap/policy/pdp
+2localhost.org.apache.juli.AsyncFileHandler.prefix = localhost.
+
+3manager.org.apache.juli.AsyncFileHandler.level = FINE
+3manager.org.apache.juli.AsyncFileHandler.directory = /var/log/onap/policy/pdp
+3manager.org.apache.juli.AsyncFileHandler.prefix = manager.
+
+4host-manager.org.apache.juli.AsyncFileHandler.level = FINE
+4host-manager.org.apache.juli.AsyncFileHandler.directory = /var/log/onap/policy/pdp
+4host-manager.org.apache.juli.AsyncFileHandler.prefix = host-manager.
+
+java.util.logging.ConsoleHandler.level = FINE
+java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter
+
+
+############################################################
+# Facility specific properties.
+# Provides extra control for each logger.
+############################################################
+
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.AsyncFileHandler
+
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.AsyncFileHandler
+
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 4host-manager.org.apache.juli.AsyncFileHandler
+
+# For example, set the org.apache.catalina.util.LifecycleBase logger to log
+# each component that extends LifecycleBase changing state:
+#org.apache.catalina.util.LifecycleBase.level = FINE
+
+# To see debug messages in TldLocationsCache, uncomment the following line:
+#org.apache.jasper.compiler.TldLocationsCache.level = FINE
+
diff --git a/packages/docker/src/main/docker/docker-install.sh b/packages/docker/src/main/docker/docker-install.sh
index e8b9aaf..5c85611 100644
--- a/packages/docker/src/main/docker/docker-install.sh
+++ b/packages/docker/src/main/docker/docker-install.sh
@@ -151,6 +151,7 @@
 	SED_LINE+=" -e 's!\${{KEYSTORE_PASSWD}}!${KEYSTORE_PASSWD}!g' "
 	SED_LINE+=" -e 's!\${{JAVA_HOME}}!${JAVA_HOME}!g' "
 	SED_LINE+=" -e 's!\${{COMPONENT_TYPE}}!${COMPONENT_TYPE}!g' "
+	SED_LINE+=" -e 's!\${{POLICY_LOGS}}!${POLICY_LOGS}!g' "
 		
 	while read line || [ -n "${line}" ]; do
         if [[ -n $line ]] && [[ $line != \#* ]]; then
@@ -658,6 +659,11 @@
 	exit 1
 fi
 
+if [[ -z ${POLICY_LOGS} ]]; then
+    echo "POLICY_LOGS environment variable NOT set, default to /var/log/onap"
+    export POLICY_LOGS="/var/log/onap"
+fi
+
 FQDN=$(hostname -f 2> /dev/null)
 if [[ $? != 0 || -z ${FQDN} ]]; then
 	echo "error: cannot determine the FQDN for this host $(hostname)."
diff --git a/packages/install/src/files/paplp.conf b/packages/install/src/files/paplp.conf
index f5a6d09..e4fc837 100755
--- a/packages/install/src/files/paplp.conf
+++ b/packages/install/src/files/paplp.conf
@@ -4,8 +4,8 @@
 LOGPARSER_X_MX_MB=1024
 
 SERVER=https://${{FQDN}}:9091/pap/
-LOGPATH=${{POLICY_HOME}}/servers/pap/logs/pap-rest.log
-PARSERLOGPATH=IntegrityMonitor.log
+LOGPATH=${POLICY_LOGS}/policy/pap/pap-rest.log
+PARSERLOGPATH=${POLICY_LOGS}/policy/pap/IntegrityMonitor.log
 
 node_type=logparser
 # the java property is RESOURCE_NAME (uppercase), but the conf parameter is lowercase
diff --git a/packages/install/src/files/pdplp.conf b/packages/install/src/files/pdplp.conf
index 716326c..9397e48 100755
--- a/packages/install/src/files/pdplp.conf
+++ b/packages/install/src/files/pdplp.conf
@@ -4,8 +4,8 @@
 LOGPARSER_X_MX_MB=1024
 
 SERVER=https://${{FQDN}}:8081/pdp/
-LOGPATH=${{POLICY_HOME}}/servers/pdp/logs/pdp-rest.log
-PARSERLOGPATH==IntegrityMonitor.log
+LOGPATH=${POLICY_LOGS}/policy/pdpx/pdp-rest.log
+PARSERLOGPATH=${POLICY_LOGS}/policy/pdpx/IntegrityMonitor.log
 
 node_type=logparser
 # the java property is RESOURCE_NAME (uppercase), but the conf parameter is lowercase