[LOG] Add canonicalization for SDNC logs 47/7347/3
authorVidya Shinde <vidya.shinde@amdocs.com>
Fri, 11 Aug 2017 13:00:33 +0000 (18:30 +0530)
committerVidya Shinde <vidya.shinde@amdocs.com>
Tue, 22 Aug 2017 07:13:52 +0000 (12:43 +0530)
Canonicalization of path for log provider configuration file and log files

Change-Id: I87eba94a3026f53a64d044ea1a59da034930dace
Issue-ID: LOG-23
Signed-off-by: Vidya Shinde <vidya.shinde@amdocs.com>
onap/sdnc/README.md [new file with mode: 0644]
onap/sdnc/conf/org.ops4j.pax.logging.cfg [new file with mode: 0644]

diff --git a/onap/sdnc/README.md b/onap/sdnc/README.md
new file mode 100644 (file)
index 0000000..a8d00a9
--- /dev/null
@@ -0,0 +1,23 @@
+####################################################################################################################################################################
+## SDNC Logging Configuration
+====================================================================================================================================================================
+SDNC has four docker containers -sdnc_dgbuilder_container, sdnc_portal_container, sdnc_controller_container,sdnc_db_container.
+The canonical logging implementation is only done for the container, sdnc_controller_container.
+Canonical logs will be generated at /var/log/onap/sdnc/
+====================================================================================================================================================================
+## Instructions for deployment
+====================================================================================================================================================================
+  1. Create the canonical path for log provider, /etc/onap/sdnc/conf.d/,on the host VM.
+  2. Copy the canonical \91org.ops4j.pax.logging.cfg\92 from 'sdnc' directory (of gerrit) into the path created in step 1.
+  3. Create the canonical path for logs, /var/log/onap/sdnc, on the host VM.
+  4. Provide write permissions for "others" users for directory created in step 3.
+  5. Volume-Mount: The sdnc container requires two host paths mapped as volume in the container
+        
+      5.1. Log file path:
+        Host path -      /var/log/onap/sdnc/ mapped to
+        Container path - /var/log/onap/sdnc/
+      5.2. Log provider file path: 
+          Host Path         : /etc/onap/sdnc/conf.d/org.ops4j.pax.logging.cfg mapped to
+                Container path    : ${karaf_data}/etc/org.ops4j.pax.logging.cfg
+                Note: The current value of ${karaf_data} is /opt/opendaylight/distribution-karaf-0.4.2-Beryllium-SR2/data, which may change depending upon the karaf version.
+####################################################################################################################################################################
diff --git a/onap/sdnc/conf/org.ops4j.pax.logging.cfg b/onap/sdnc/conf/org.ops4j.pax.logging.cfg
new file mode 100644 (file)
index 0000000..485b3fc
--- /dev/null
@@ -0,0 +1,58 @@
+################################################################################
+#
+#    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.
+#
+################################################################################
+
+# Root logger
+log4j.rootLogger=INFO, async, osgi:*
+log4j.throwableRenderer=org.apache.log4j.OsgiThrowableRenderer
+
+# Log Directory
+logDir=/var/log/onap
+componentName=sdnc
+logDirectory=${logDir}/${componentName}
+maxFileSize=100MB
+maxBackupIndex=20
+
+# CONSOLE appender not used by default
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd'T'HH:mm:ss.SSS}\t%-16.16t\t%-5.5p\t%c{36}\t%X{bundle.id} - %X{bundle.name} - %X{bundle.version}\t%m%n
+
+# Async appender forwarding to file appender 
+log4j.appender.async=org.apache.log4j.AsyncAppender
+log4j.appender.async.appenders=out
+
+# File appender
+log4j.appender.out=org.apache.log4j.RollingFileAppender
+log4j.appender.out.layout=org.apache.log4j.xml.XMLLayout
+log4j.appender.out.layout.Properties=true
+log4j.appender.out.file=${logDirectory}/karaf.log
+log4j.appender.out.append=true
+log4j.appender.out.maxFileSize=${maxFileSize}
+log4j.appender.out.maxBackupIndex=${maxBackupIndex}
+
+# Sift appender
+log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender
+log4j.appender.sift.key=bundle.name
+log4j.appender.sift.default=karaf
+log4j.appender.sift.appender=org.apache.log4j.RollingFileAppender
+log4j.appender.sift.appender.layout=org.apache.log4j.xml.XMLLayout
+log4j.appender.sift.appender.layout.Properties=true
+log4j.appender.sift.appender.file=${logDirectory}/$\\{bundle.name\\}.log
+log4j.appender.sift.appender.append=true
+