Update logging Rest API 13/6413/1
authorSumit Kaushik <sk00613223@TechMahindra.com>
Tue, 4 Feb 2020 12:51:04 +0000 (18:21 +0530)
committerSumit Kaushik <sk00613223@TechMahindra.com>
Tue, 4 Feb 2020 12:56:21 +0000 (18:26 +0530)
ISSUE-ID : ACUMOS-3892

Remove Demo from logging Rest API

Change-Id: I55b0524cb6c1bd60cb219979f9758b6297f9e654
Signed-off-by: Sumit Kaushik <sk00613223@TechMahindra.com>
19 files changed:
logging-rest-library/.classpath [new file with mode: 0644]
logging-rest-library/.gitignore [new file with mode: 0644]
logging-rest-library/.project [new file with mode: 0644]
logging-rest-library/.settings/org.eclipse.core.resources.prefs [new file with mode: 0644]
logging-rest-library/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
logging-rest-library/.settings/org.eclipse.m2e.core.prefs [new file with mode: 0644]
logging-rest-library/.settings/org.eclipse.wst.common.project.facet.core.xml [new file with mode: 0644]
logging-rest-library/.springBeans [new file with mode: 0644]
logging-rest-library/pom.xml [new file with mode: 0644]
logging-rest-library/src/main/java/README.md [new file with mode: 0644]
logging-rest-library/src/main/java/com/logging/rest/example/springbootswagger2/SpringBootSwagger2Application.java [new file with mode: 0644]
logging-rest-library/src/main/java/com/logging/rest/example/springbootswagger2/configuration/Swagger2UiConfiguration.java [new file with mode: 0644]
logging-rest-library/src/main/java/com/logging/rest/example/springbootswagger2/controller/APINames.java [new file with mode: 0644]
logging-rest-library/src/main/java/com/logging/rest/example/springbootswagger2/controller/JSONTags.java [new file with mode: 0644]
logging-rest-library/src/main/java/com/logging/rest/example/springbootswagger2/controller/JsonRequest.java [new file with mode: 0644]
logging-rest-library/src/main/java/com/logging/rest/example/springbootswagger2/controller/JsonResponse.java [new file with mode: 0644]
logging-rest-library/src/main/java/com/logging/rest/example/springbootswagger2/controller/LoggingController.java [new file with mode: 0644]
logging-rest-library/src/main/resources/application.properties [new file with mode: 0644]
logging-rest-library/src/main/resources/logback.xml [new file with mode: 0644]

diff --git a/logging-rest-library/.classpath b/logging-rest-library/.classpath
new file mode 100644 (file)
index 0000000..dfd0043
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
+               <attributes>
+                       <attribute name="maven.pomderived" value="true"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry kind="src" output="target/classes" path="src/main/java">
+               <attributes>
+                       <attribute name="optional" value="true"/>
+                       <attribute name="maven.pomderived" value="true"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+               <attributes>
+                       <attribute name="maven.pomderived" value="true"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+               <attributes>
+                       <attribute name="optional" value="true"/>
+                       <attribute name="maven.pomderived" value="true"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
+               <attributes>
+                       <attribute name="maven.pomderived" value="true"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+               <attributes>
+                       <attribute name="maven.pomderived" value="true"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/logging-rest-library/.gitignore b/logging-rest-library/.gitignore
new file mode 100644 (file)
index 0000000..b83d222
--- /dev/null
@@ -0,0 +1 @@
+/target/
diff --git a/logging-rest-library/.project b/logging-rest-library/.project
new file mode 100644 (file)
index 0000000..f79b6f7
--- /dev/null
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>logging-rest-library</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.wst.common.project.facet.core.builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.springframework.ide.eclipse.core.springbuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.m2e.core.maven2Builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.springframework.ide.eclipse.core.springnature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.m2e.core.maven2Nature</nature>
+               <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+       </natures>
+</projectDescription>
diff --git a/logging-rest-library/.settings/org.eclipse.core.resources.prefs b/logging-rest-library/.settings/org.eclipse.core.resources.prefs
new file mode 100644 (file)
index 0000000..29abf99
--- /dev/null
@@ -0,0 +1,6 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/main/resources=UTF-8
+encoding//src/test/java=UTF-8
+encoding//src/test/resources=UTF-8
+encoding/<project>=UTF-8
diff --git a/logging-rest-library/.settings/org.eclipse.jdt.core.prefs b/logging-rest-library/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..13b3428
--- /dev/null
@@ -0,0 +1,13 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/logging-rest-library/.settings/org.eclipse.m2e.core.prefs b/logging-rest-library/.settings/org.eclipse.m2e.core.prefs
new file mode 100644 (file)
index 0000000..f897a7f
--- /dev/null
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/logging-rest-library/.settings/org.eclipse.wst.common.project.facet.core.xml b/logging-rest-library/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100644 (file)
index 0000000..d858295
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+  <installed facet="cloudfoundry.standalone.app" version="1.0"/>
+</faceted-project>
diff --git a/logging-rest-library/.springBeans b/logging-rest-library/.springBeans
new file mode 100644 (file)
index 0000000..ceef0df
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beansProjectDescription>
+       <version>1</version>
+       <pluginVersion><![CDATA[3.8.3.201612191259-RELEASE]]></pluginVersion>
+       <configSuffixes>
+               <configSuffix><![CDATA[xml]]></configSuffix>
+       </configSuffixes>
+       <enableImports><![CDATA[false]]></enableImports>
+       <configs>
+               <config>java:com.logging.rest.example.springbootswagger2.SpringBootSwagger2Application</config>
+       </configs>
+       <autoconfigs>
+       </autoconfigs>
+       <configSets>
+       </configSets>
+</beansProjectDescription>
diff --git a/logging-rest-library/pom.xml b/logging-rest-library/pom.xml
new file mode 100644 (file)
index 0000000..dda007c
--- /dev/null
@@ -0,0 +1,99 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+
+       <groupId>com.logging.rest.example</groupId>
+       <artifactId>logging-rest-library</artifactId>
+       <version>3.0.6-SNAPSHOT</version>
+       <packaging>jar</packaging>
+       <name>logging-rest-library</name>
+       <description>logging-rest-library API for logging library</description>
+       <parent>
+               <groupId>org.springframework.boot</groupId>
+               <artifactId>spring-boot-starter-parent</artifactId>
+               <version>1.5.4.RELEASE</version>
+               <relativePath /> <!-- lookup parent from repository -->
+       </parent>
+
+       <properties>
+               <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+               <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+               <java.version>1.8</java.version>
+       </properties>
+
+       <dependencies>
+               <dependency>
+                       <groupId>io.springfox</groupId>
+                       <artifactId>springfox-swagger2</artifactId>
+                       <version>2.6.1</version>
+               </dependency>
+
+               <dependency>
+                       <groupId>io.springfox</groupId>
+                       <artifactId>springfox-swagger-ui</artifactId>
+                       <version>2.6.1</version>
+               </dependency>
+               
+               <dependency>
+                       <groupId>org.acumos.platform-oam</groupId>
+                       <artifactId>logging-library</artifactId>
+                       <version>3.0.6-SNAPSHOT</version>
+               </dependency>
+               
+               
+               <dependency>
+                       <groupId>org.springframework.boot</groupId>
+                       <artifactId>spring-boot-starter-actuator</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.springframework.boot</groupId>
+                       <artifactId>spring-boot-starter-data-rest</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.springframework.boot</groupId>
+                       <artifactId>spring-boot-starter-web</artifactId>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.springframework.boot</groupId>
+                       <artifactId>spring-boot-starter-test</artifactId>
+                       <scope>test</scope>
+               </dependency>
+       </dependencies>
+       
+       <repositories>
+               <repository>
+                       <id>maven Repo1</id>
+                       <name>maven Repo1</name>
+                       <url>http://repo1.maven.org/maven2</url>
+               </repository>
+               <repository>
+                       <id>Sonatype repository</id>
+                       <name>Sonatype's Maven repository</name>
+                       <url>http://oss.sonatype.org/content/groups/public</url>
+               </repository>
+
+       </repositories>
+
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.springframework.boot</groupId>
+                               <artifactId>spring-boot-maven-plugin</artifactId>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-compiler-plugin</artifactId>
+                               <version>3.3</version>
+                               <configuration>
+                                       <source>1.8</source>
+                                       <target>1.8</target>
+                               </configuration>
+                       </plugin>
+               </plugins>
+       </build>
+
+
+</project>
+       
\ No newline at end of file
diff --git a/logging-rest-library/src/main/java/README.md b/logging-rest-library/src/main/java/README.md
new file mode 100644 (file)
index 0000000..b282e95
--- /dev/null
@@ -0,0 +1,207 @@
+
+==================================
+Logging Library Developer Guide
+==================================
+What is Logging Library?
+=======================
+
+Logging Library has the following given below features :
+
+There are two .java(ACUMOSLogConstants and LogConfig.java) files and one logback.xml file is there.
+
+1.In the ACUMOSLogConstants.java following  given below features are there.
+Marker
+====================
+Marker is a spacial class  has the given below features.
+
+Java logging frameworks allow you to filter log messages based on the logger name and the message log level.You can tag your
+log messages with user-defined markers in order to filter them later on.
+
+Markers are named objects used to enrich log statements. Conforming logging system Implementations of SLF4J determine how
+information conveyed by markers are used, if at all. In particular, many conforming logging systems ignore marker data.
+For this example, we will be using Logback as logger with SLF4J.Logback was conceived and created as a successor to Log4J.
+Logback supports markers for the logging calls. These Markers allow association of tags with log statements. 
+
+Marker has following given below attributes as INVOKE,INVOKE_RETURN,INVOKE_SYNCHRONOUS,INVOKE_ASYNCHRONOUS,ENTRY & EXIT
+,User can select any of the attribute as per his choice.
+
+MDC
+=====
+
+The MDC manages contextual information on a per thread basis. Typically, while starting to service a new client request,
+the developer will insert pertinent contextual information, such as the client id, client's IP address, request parameters
+etc. into the MDC.Logback components, if appropriately configured, will automatically include this information in each log
+entry.
+
+MDC in Log4j allows us to fill a map-like structure with pieces of information that are accessible to the appender when 
+the log message is actually written.The MDC structure is internally attached to the executing thread in the same way a 
+ThreadLocal variable would be.
+
+And so, the high level idea is:to fill the MDC with pieces of information that we want to make available to the appender
+then log a message and finally, clear the MDC.
+
+Most server applications need to handle multiple clients simultaneously. Typically, the server application allocates a 
+separate thread to handle a single client request. In such a system different threads handle different client requests 
+in parallel and the log messages written by the threads interleave. In order to differentiate log messages from different
+threads from each other a diagnostic context comes in handy.Diagnostic context is a map associated with a particular thread.
+Each thread maintains its own map. You can store arbitrary key-value pairs in the map and in turn lay out your log messages 
+to include the values from the map.
+
+MDC has following given below attributes as REQUEST_ID,TARGET_SERVICE_NAME,TARGET_ENTITY,CLIENT_IP_ADDRESS,SERVER_FQDN,
+RESPONSE_CODE,RESPONSE_DESCRIPTION,RESPONSE_SEVERITY & STATUS_CODE,User can select any of the attribute as per his choice.
+
+We have two (1- MDC, and 2 - MDCs )
+New MDCs are added to serve more better way for ResponseStatusMDC and ResponseSeverityMDC of MDCs.
+It will be useful in logging the thread requests/responses.
+For more information we have added thread specific ResponseStatusMDC  which has three attributes as  MDC_COMPLETED,  MDC_ERROR 
+&  MDC_INPROGRESS, user can select one of these attributes in logging statements like below:
+public enum ResponseStatusMDC {
+                     
+                     MDC_COMPLETED,
+                     MDC_ERROR,
+                     MDC_INPROGRESS
+}
+Also for thread specific MDC had added ResponseSeverityMDC  which has six attributes as MDC_INFO,  MDC_ERROR,  MDC_TRACE,
+ MDC_DEBUG, MDC_WARN, MDC_FATAL.user can select one of these attributes in logging statements.
+  public enum ResponseSeverityMDC
+{    MDC_INFO,    MDC_ERROR,    MDC_TRACE,    MDC_DEBUG,    MDC_WARN,    MDC_FATAL   }
+
+Implementation of MDC 
+=====================
+How MDC are called externally from other project through the method setEnteringMDCs in LogConfig.java.
+MDC is used for thread specific request so we just call this method setEnteringMDCs().
+
+               MDC.put(MDCs.REQUEST_ID, requestId);            
+               MDC.put(MDCs.TARGET_ENTITY, targetEntry);
+               MDC.put(MDCs.TARGET_SERVICE_NAME, targetService);
+               MDC.put(MDCs.CLIENT_IP_ADDRESS, ip);
+               MDC.put(MDCs.SERVER_FQDN, hostname);
+               MDC.put(MDCs.USER, user);
+
+In this method setEnteringMDCs() we write the given below lines for the specific thread.
+
+Also whatever parameters we pass as responseCode & responseSeverity in
+setEnteringMDCs(String targetEntry,String targetService,String user,String responseCode,String responseSeverity) method.
+
+There are conditions according to whatever ResponseStatusMDC & ResponseSeverityMDC you want to implement in logging statements
+that will be printed in your logging statements with the help of given below statements as :
+
+For example if you pass responseCode as MDC_COMPLETED then  given below lines will be printed in your logging statements.
+MDC.put(MDCs.RESPONSE_DESCRIPTION, MDCs.ResponseStatusMDC.MDC_COMPLETED.toString());
+
+And For example if you pass responseSeverity as MDC_INFO then  given below lines will be printed in your logging statements.
+MDC.put(MDCs.RESPONSE_SEVERITY, MDCs.ResponseSeverityMDC.MDC_INFO.toString());
+       
+
+Header
+=======
+In this class there is one attribute as REQUEST_ID whose value is X-ACUMOS-RequestID.
+
+ResponseStatus enumeration
+==========================
+In this enumeration there are three types of Response Status as COMPLETED,ERROR,INPROGRESS.The end user can choose any of the
+response attribute as per his choice.
+
+ResponseSeverity enumeration:
+=============================
+In this enumeration there are five types of Response Severity is given as :INFO,ERROR,TRACE,DEBUG,WARN,FATAL.The end user can
+choose any of the response severity attribute as per his choice.
+
+InvocationMode enumeration
+==========================
+Invocation mode can be SYNCHRONOUS or ASYNCHRONOUS as per the user requirement.
+
+2.Another File is the LogConfig.java
+====================================
+In this file there is a static method as LogConfig.setEnteringMDCs(String targetEntry,String targetService,String user,String responseCode,String responseSeverity)
+The user puts the entries in HashMap in the given below format.
+
+               MDC.put(MDCs.REQUEST_ID, requestId);            
+               MDC.put(MDCs.TARGET_ENTITY, targetEntry);
+               MDC.put(MDCs.TARGET_SERVICE_NAME, targetService);
+               MDC.put(MDCs.CLIENT_IP_ADDRESS, ip);
+               MDC.put(MDCs.SERVER_FQDN, hostname);
+               MDC.put(MDCs.USER, user);
+Where responseCode & responseSeverity the user will pass whatever thread specific ResponseStatusMDC    & ResponseSeverityMDC he wants 
+to implement in the logging statements.        
+               MDC.put(MDCs.RESPONSE_DESCRIPTION, MDCs.ResponseStatusMDC.MDC_COMPLETED.toString());
+               MDC.put(MDCs.RESPONSE_SEVERITY, MDCs.ResponseSeverityMDC.MDC_INFO.toString());
+               
+Here the targetEntry is the maven project module name for example in maven project elk-client the targetEntry name is
+elk-client.
+
+Here the targetEntry is end point url of the rest api method which we want to access.For example to fetch all the indices of 
+elastic search we define end point url of the reat api as /all/indices in the ElkClientConstants.GET_ALL_INDICES and
+define GET_ALL_INDICES whose value is /all/indices in the ElkClientConstants.java file. 
+
+Here the user is the who login into the web application and accessing the particular maven project module.
+
+3.Logback.xml
+=============
+We have defined various appenders while help in creating the log statements.With the help of these appenders we can print
+the logs as per user requirement.
+
+================================================
+Testing Logging Library Developer Guide
+================================================
+What is Logging Library Testing Rest API?
+================================================
+1.Rest API Test.
+=============================
+We have created logging-rest-demo project, in this project we are importing the logging-demo jar so we will import all the
+functionality & various features of the logging-demo project through the logging-demo jar.
+We have created some Rest API methods in the test project logging-rest-demo in that we are implementing the different different
+features of the logging-demo project.
+
+How to implement the Logging Library jar?
+========================================= 
+
+To implement the Logging Library jar,there are some few specific given below guidelines which the developer should use while
+implementing the logging-demo jar.
+
+1.In the starting of the implemented REST API method first use the line from the Logging Library jar as 
+ LogConfig.setEnteringMDCs(String targetEntry, String targetService, String user, String responseCode,String responseSeverity)
+
+Where the targetEntry is your maven module name,targetService is the REST API url of the exposed method,user is who has login
+into the system,responseCode is the ResponseStatusMDC and responseSeverity is the ResponseSeverityMDC,you can choose any values
+out of the values given in the ResponseStatusMDC & ResponseSeverityMDC.
+
+2.Then use the particular log levels like debug,error,info,fatal,warn etc whatever you want to implement in your logging statements.
+
+3.Suppose you want to enrich the logs with some particular Marker then for this first initialize the MarkerFactory.getIMarkerFactory();
+Then use the line as logger.error(MarkerFactory.getMarker(markerInputVal), "This is a serious an User Input Marker error requiring the admin's attention",new Exception("Just testing")); 
+where markerInputVal is the particular marker which you want to use in your application.
+
+4.In the end of the implemented REST API method use the line LogConfig.clearMDCDetails() to clear all the log MDC details.
+
+Steps to include logging-demo.jar in your project.
+==================================================
+
+Logging Library is provided in the form of as a jar,Suppose we want to add this logging-demo.jar to a new project then given
+below are the steps to in guide this jar and use in your project.
+
+1.Add the given below entry in dependency section of the pom.xml of your new project.
+               <dependency>
+                       <groupId>org.acumos.platform-oam</groupId>
+                       <artifactId>logging-demo</artifactId>
+                       <version>3.0.4-SNAPSHOT</version>
+               </dependency>
+               
+2.Publish the logging-demo.jar into the maven repository.
+               
+3.Now Suppose you want to add logging related statements in your java files then just you need to write the logger.Debug_levels
+as per your requirement, like debug,error,fatal,info,warn.
+
+4.Whatever logging functionality you want in your logging statements as per your requirement,you can just import from the 
+classes files of the jar.
+
+
+You will import the appropriate,required  and use it your project as per the end user requirement.To see how you can use the
+logging-demo library ,you can refer to the above section Logging Library Developer Guide.
+
+
+
+
+
+
+
diff --git a/logging-rest-library/src/main/java/com/logging/rest/example/springbootswagger2/SpringBootSwagger2Application.java b/logging-rest-library/src/main/java/com/logging/rest/example/springbootswagger2/SpringBootSwagger2Application.java
new file mode 100644 (file)
index 0000000..fbc7cc1
--- /dev/null
@@ -0,0 +1,12 @@
+package com.logging.rest.example.springbootswagger2;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class SpringBootSwagger2Application {
+
+       public static void main(String[] args) {
+               SpringApplication.run(SpringBootSwagger2Application.class, args);
+       }
+}
diff --git a/logging-rest-library/src/main/java/com/logging/rest/example/springbootswagger2/configuration/Swagger2UiConfiguration.java b/logging-rest-library/src/main/java/com/logging/rest/example/springbootswagger2/configuration/Swagger2UiConfiguration.java
new file mode 100644 (file)
index 0000000..c11bdb5
--- /dev/null
@@ -0,0 +1,36 @@
+package com.logging.rest.example.springbootswagger2.configuration;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+import com.google.common.base.Predicates;
+
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+@Configuration
+@EnableSwagger2
+public class Swagger2UiConfiguration extends WebMvcConfigurerAdapter  {
+       @Bean
+       public Docket api() {
+               // @formatter:off
+               return new Docket(DocumentationType.SWAGGER_2)
+                               .select()
+                               .apis(Predicates.not(RequestHandlerSelectors.basePackage("org.springframework.boot")))
+                               .build()
+                               ;
+               // @formatter:on
+       }
+       
+       @Override
+       public void addResourceHandlers(ResourceHandlerRegistry registry) {
+               registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
+               registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
+       }
+
+
+}
diff --git a/logging-rest-library/src/main/java/com/logging/rest/example/springbootswagger2/controller/APINames.java b/logging-rest-library/src/main/java/com/logging/rest/example/springbootswagger2/controller/APINames.java
new file mode 100644 (file)
index 0000000..04cac4a
--- /dev/null
@@ -0,0 +1,45 @@
+/*-
+ * ===============LICENSE_START=======================================================
+ * Acumos
+ * ===================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property & Tech Mahindra. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ===================================================================================
+ * This Acumos software file is distributed by AT&T and Tech Mahindra
+ * 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
+ *  
+ * This file 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.
+ * ===============LICENSE_END=========================================================
+ */
+
+package com.logging.rest.example.springbootswagger2.controller;
+
+/**
+ *
+ * Constants class to list all the REST API endpoints
+ */
+public class APINames {
+
+       public static final String CHARSET = "application/json;charset=utf-8";
+
+       public static final String GET_CATALOG_TEST = "/catalogTest";
+       public static final String GET_CATALOG_TEST_REQUEST = GET_CATALOG_TEST + "/{markerInput}";
+       public static final String CREATE_RTU_USER = "/createRtuUser/{markerInputVal}/{user}";
+       public static final String CREATE_RTU_USER_TEST = CREATE_RTU_USER + "/{markerInputVal}/{user}";
+
+       public static final String INFO = "/info";
+       public static final String GET_INFO = INFO + "/{revisionId}/{solutionId}";
+
+       public static final String TEST = "/test";
+       public static final String GET_TEST = TEST + "/{markerInput}/{user}";
+
+       public static final String DEBUG = "/debug";
+       public static final String DEBUG_TEST = DEBUG + "/{markerInput}/{markerInput1}/{user}";
+}
\ No newline at end of file
diff --git a/logging-rest-library/src/main/java/com/logging/rest/example/springbootswagger2/controller/JSONTags.java b/logging-rest-library/src/main/java/com/logging/rest/example/springbootswagger2/controller/JSONTags.java
new file mode 100644 (file)
index 0000000..ba03212
--- /dev/null
@@ -0,0 +1,63 @@
+/*-
+ * ===============LICENSE_START=======================================================
+ * Acumos
+ * ===================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property & Tech Mahindra. All rights reserved.
+ * ===================================================================================
+ * This Acumos software file is distributed by AT&T and Tech Mahindra
+ * 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
+ *  
+ * This file 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.
+ * ===============LICENSE_END=========================================================
+ */
+
+package com.logging.rest.example.springbootswagger2.controller;
+
+public class JSONTags {
+       
+       public static final String TAG_REQUEST_FNAME = "first_name";
+       public static final String TAG_REQUEST_MNAME = "middle_name";
+       public static final String TAG_STATUS_SUCCESS = "success";
+       public static final String TAG_RESPONSE_STATUS = "status";
+       public static final String TAG_RESPONSE_STATUS_CODE = "status_code";
+       public static final String TAG_REQUEST_FROM = "request_from";
+       public static final String TAG_REQUEST_ID = "request_id";
+       public static final String TAG_REQUEST_BODY = "request_body";
+       public static final String TAG_REQUEST_UNIQUE_ID = "userId";
+       public static final String TAG_STATUS_FAILURE = "failure";
+       public static final String TAG_REQUEST_UID = "user_id";
+       public static final String TAG_REQUEST_PASSWORD = "password";
+
+       public static final String TAG_RESPONSE_DETAIL = "response_detail";
+       public static final String TAG_RESPONSE_BODY = "response_body";
+       public static final String TAG_RESPONSE_CONTENT = "content";
+       public static final String TAG_RESPONSE_MESSAGE = "request";
+       public static final String TAG_ERROR_CODE = "error_code";
+       public static final String TAG_RESPONSE_CODE = "response_code";
+       public static final String TAG_ERROR_CODE_SUCCESS = "100";
+       public static final String TAG_ERROR_CODE_FAILURE = "500";
+       public static final String TAG_ERROR_CODE_EXCEPTION = "400";
+       public static final String TAG_ERROR_CODE_RESET_USERNAME = "202";
+       public static final String TAG_ERROR_CODE_RESET_EMAILID = "203";
+       public static final String TAG_ERROR_CODE_OLDPASS_NOTMATCH = "204";
+       public static final String TAG_ERROR_RESPONSE = "205";
+       public static final String TAG_INFO_SV = "sv_info";
+       public static final String TAG_ERROR_SV = "sv_error";
+       
+       public static final String ROLE_ID = "roleId";
+       public static final String ROLE_NAME = "name";
+       public static final String ROLE_ACTIVE = "active";
+       public static final String ROLE_CREATED = "created";
+       public static final String ROLE_MODIFIED = "modified";
+       
+       public static final String REQUEST_APPROVED = "approve";
+       public static final String REQUEST_DENIED = "deny";
+}
diff --git a/logging-rest-library/src/main/java/com/logging/rest/example/springbootswagger2/controller/JsonRequest.java b/logging-rest-library/src/main/java/com/logging/rest/example/springbootswagger2/controller/JsonRequest.java
new file mode 100644 (file)
index 0000000..5d61805
--- /dev/null
@@ -0,0 +1,83 @@
+/*-
+ * ===============LICENSE_START=======================================================
+ * Acumos
+ * ===================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property & Tech Mahindra. All rights reserved.
+ * ===================================================================================
+ * This Acumos software file is distributed by AT&T and Tech Mahindra
+ * 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
+ *  
+ * This file 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.
+ * ===============LICENSE_END=========================================================
+ */
+
+package com.logging.rest.example.springbootswagger2.controller;
+
+import java.io.Serializable;
+
+//import org.acumos.portal.be.common.JSONTags;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+* This class represents a common format set for the request body sent from the client.
+* Getters and setters encapsulate the fields of a class by making them accessible 
+* only through its public methods and keep the values themselves private.
+ * @param <T> Type inside request
+*/
+
+public class JsonRequest<T> implements Serializable{
+
+       private static final long serialVersionUID = 7576436006913504503L;
+
+       /**
+        * Json property requestFrom.
+        */
+       @JsonProperty(value = JSONTags.TAG_REQUEST_FROM)
+       private String requestFrom;
+
+       /**
+        * Json property requestId.
+        */
+       @JsonProperty(value = JSONTags.TAG_REQUEST_ID)
+       private String requestId;
+       
+       /**
+        * Json property body. It represents the type of generic object.
+        */
+       @JsonProperty(value = JSONTags.TAG_REQUEST_BODY)
+       private T body;
+
+       public String getRequestId() {
+               return requestId;
+       }
+
+       public void setRequestId(String requestId) {
+               this.requestId = requestId;
+       }
+       
+       
+       public T getBody() {
+               return body;
+       }
+
+       public void setBody(T body) {
+               this.body = body;
+       }
+
+       public String getRequestFrom() {
+               return requestFrom;
+       }
+
+       public void setRequestFrom(String requestFrom) {
+               this.requestFrom = requestFrom;
+       }
+       
+}
diff --git a/logging-rest-library/src/main/java/com/logging/rest/example/springbootswagger2/controller/JsonResponse.java b/logging-rest-library/src/main/java/com/logging/rest/example/springbootswagger2/controller/JsonResponse.java
new file mode 100644 (file)
index 0000000..a10c41a
--- /dev/null
@@ -0,0 +1,136 @@
+/*-
+ * ===============LICENSE_START=======================================================
+ * Acumos
+ * ===================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property & Tech Mahindra. All rights reserved.
+ * ===================================================================================
+ * This Acumos software file is distributed by AT&T and Tech Mahindra
+ * 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
+ *  
+ * This file 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.
+ * ===============LICENSE_END=========================================================
+ */
+
+package com.logging.rest.example.springbootswagger2.controller;
+
+
+/**
+* This class represents a common format set for the response send to the client.
+* Getters and setters encapsulate the fields of a class by making them accessible 
+* only through its public methods and keep the values themselves private.
+* @JsonProperty(name), tells Jackson ObjectMapper to map the JSON property name to the annotated Java field's name.
+*/
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class JsonResponse<T> implements Serializable {
+
+       private static final long serialVersionUID = -2934104266393591755L;
+
+       /**
+        * Json property status.
+        */
+       @JsonProperty(value = JSONTags.TAG_RESPONSE_STATUS)
+       private Boolean status;
+
+       /**
+        * Json property statusCode.
+        */
+       @JsonProperty(value = JSONTags.TAG_RESPONSE_STATUS_CODE)
+       private int statusCode;
+       
+       /**
+        * Json property responseDetail.
+        */
+       @JsonProperty(value = JSONTags.TAG_RESPONSE_DETAIL)
+       private String responseDetail;
+
+       /**
+        * Json property responseCode.
+        */
+       @JsonProperty(value = JSONTags.TAG_RESPONSE_CODE)
+       private String responseCode;
+
+       /**
+        * Json property responseBody. It represents the type of generic object.
+        */
+       @JsonProperty(value = JSONTags.TAG_RESPONSE_BODY)
+       private T responseBody;
+       
+       /**
+        * Json property content. It represents the type of generic object.
+        */
+       @JsonProperty(value = JSONTags.TAG_RESPONSE_CONTENT)
+       private T content;
+       
+       public Boolean getStatus() {
+               return status;
+       }
+
+       public void setStatus(Boolean status) {
+               this.status = status;
+       }
+
+       public String getResponseDetail() {
+               return responseDetail;
+       }
+
+       public void setResponseDetail(String responseDetail) {
+               this.responseDetail = responseDetail;
+       }
+
+       /**
+        * Json property errorCode.
+        */
+       @JsonProperty(value = JSONTags.TAG_ERROR_CODE)
+       private String errorCode;
+
+       public String getErrorCode() {
+               return errorCode;
+       }
+
+       public void setErrorCode(String errorCode) {
+               this.errorCode = errorCode;
+       }
+               
+       public String getResponseCode() {
+               return responseCode;
+       }
+
+       public void setResponseCode(String responseCode) {
+               this.responseCode = responseCode;
+       }
+
+       public T getResponseBody() {
+               return responseBody;
+       }
+
+       public void setResponseBody(T responseBody) {
+               this.responseBody = responseBody;
+       }
+
+       public T getContent() {
+               return content;
+       }
+
+       public void setContent(T responseBody) {
+               this.content = responseBody;
+       }
+
+       public int getStatusCode() {
+               return statusCode;
+       }
+
+       public void setStatusCode(int statusCode) {
+               this.statusCode = statusCode;
+       }
+}
diff --git a/logging-rest-library/src/main/java/com/logging/rest/example/springbootswagger2/controller/LoggingController.java b/logging-rest-library/src/main/java/com/logging/rest/example/springbootswagger2/controller/LoggingController.java
new file mode 100644 (file)
index 0000000..e158aa7
--- /dev/null
@@ -0,0 +1,208 @@
+package com.logging.rest.example.springbootswagger2.controller;
+
+import java.net.InetAddress;
+import java.util.UUID;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.slf4j.MDC;
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
+import org.acumos.logging.library.util.ACUMOSLogConstants;
+import org.acumos.logging.library.util.LogConfig;
+import org.acumos.logging.library.util.LoggingConstant;
+import org.acumos.logging.library.util.ACUMOSLogConstants.InvocationMode;
+import org.acumos.logging.library.util.ACUMOSLogConstants.MDCs;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+@Api(value = "Swagger2DemoRestController", description = "Looging Apis related to Logging jar!!!!")
+@RestController
+public class LoggingController {
+
+
+
+       private static final Logger logger = LoggerFactory.getLogger(LoggingController.class);
+       private ObjectMapper mapper = new ObjectMapper();
+               
+       
+
+       @ApiOperation(value = "Get Logging publish GetInfo requests.")
+       @RequestMapping(value = { "getInfo" }, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+       @ResponseBody
+       public String getInformation(HttpServletRequest request, HttpServletResponse response) throws Exception {
+               
+               LogConfig.setEnteringMDCs("first", "second","","","");
+               //LogConfig.setEnteringMDCs("elk-client", APINames.DEBUG_TEST,"test",LoggingConstant.MDC_INPROGRESS,LoggingConstant.MDC_INFO);
+
+               
+               logger.info(InvocationMode.SYNCHRONOUS.getmMarker(), "platform-oam");
+               logger.debug("Inside getInfo Service");
+               logger.info(InvocationMode.ASYNCHRONOUS.getmMarker(), "platform-oam");
+               logger.info("Inside getInfo Service");
+
+               logger.info(InvocationMode.SYNCHRONOUS.getmMarker(), "platform-oam");
+               logger.debug("Inside getDebug Service");
+               logger.info(ACUMOSLogConstants.MDCs.getREQUEST_ID());
+               ACUMOSLogConstants.Markers.getINVOKE();
+       
+       
+       
+               logger.info(InvocationMode.SYNCHRONOUS.getmMarker(), "platform-oam");
+               logger.info(ACUMOSLogConstants.ResponseStatus.COMPLETED.toString(), "platform-oam");
+               ACUMOSLogConstants.ResponseStatus.COMPLETED.toString();
+               
+               logger.debug("Inside getInfo Service");
+               logger.info(InvocationMode.ASYNCHRONOUS.getmMarker(), "platform-oam");
+               logger.info(ACUMOSLogConstants.ResponseStatus.ERROR.toString(), "platform-oam");
+               logger.info(ACUMOSLogConstants.ResponseStatus.INPROGRESS.toString(), "platform-oam");
+               
+               logger.info(ACUMOSLogConstants.ResponseSeverity.DEBUG.toString(), "platform-oam");
+               logger.info(ACUMOSLogConstants.ResponseSeverity.ERROR.toString(), "platform-oam");
+               logger.info(ACUMOSLogConstants.ResponseSeverity.FATAL.toString(), "platform-oam");
+               logger.info(ACUMOSLogConstants.ResponseSeverity.INFO.toString(), "platform-oam");
+               logger.info(ACUMOSLogConstants.ResponseSeverity.TRACE.toString(), "platform-oam");
+               logger.info(ACUMOSLogConstants.MDCs.REQUEST_ID.toString(), "platform-oam");
+               logger.info(ACUMOSLogConstants.MDCs.RESPONSE_DESCRIPTION.toString(), "platform-oam");
+       
+               logger.info("Inside getInfo Service");
+               LogConfig.getHostDetails();
+               LogConfig.clearMDCDetails();
+               logger.info("method call ended.");
+               logger.debug("method call ended.");
+
+               return "";
+       }
+       
+       @ApiOperation(value = "Get Logging publish debug requests.")
+       @RequestMapping(value = { APINames.DEBUG_TEST }, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+       @ResponseBody
+       public String getDebug(@PathVariable String markerInput, @PathVariable("markerInput1") String markerInput1, @PathVariable("user") String user) throws Exception {
+               
+               
+               LogConfig.setEnteringMDCs("elk-client", APINames.DEBUG_TEST,user,LoggingConstant.MDC_COMPLETED,LoggingConstant.MDC_INFO);
+       
+               logger.info(InvocationMode.SYNCHRONOUS.getmMarker(), "platform-oam");
+               MarkerFactory.getIMarkerFactory();
+               logger.debug("Inside getDebug Service");
+               String markerInputVal=markerInput;
+               String markerInput1Val=markerInput1;
+               
+               logger.info(InvocationMode.SYNCHRONOUS.getmMarker(), "platform-oam");
+               logger.info(InvocationMode.SYNCHRONOUS.getmMarker(), "platform-oam");
+               
+               logger.info(ACUMOSLogConstants.MDCs.ResponseSeverityMDC.MDC_DEBUG.toString());
+       
+               logger.info(InvocationMode.SYNCHRONOUS.getmMarker(), "platform-oam");
+               
+               MarkerFactory.getMarker(markerInputVal);
+    
+       logger.error(MarkerFactory.getMarker(markerInputVal),
+                         "This is a serious an User Input Marker error requiring the admin's attention",
+                          new Exception("Just testing"));
+       
+               logger.info(InvocationMode.ASYNCHRONOUS.getmMarker(), "platform-oam");
+               logger.info("Inside getDebug Service");
+               ACUMOSLogConstants.ResponseStatus.COMPLETED.toString();
+               logger.info(ACUMOSLogConstants.ResponseSeverity.INFO.toString(), "platform-oam");
+               logger.info("method call ended.");
+               logger.debug("method call ended.");
+               LogConfig.getHostDetails();
+               LogConfig.clearMDCDetails();
+       
+
+               return "";
+       }
+       
+       
+         @ApiOperation(value = "Gets MDC details.")
+           @RequestMapping(value = { APINames.GET_TEST }, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+           @ResponseBody
+           public String getTest(@PathVariable("markerInput") String markerInput,@PathVariable("user") String user) {
+        
+               try {
+                       LogConfig.setEnteringMDCs("test", "test",user,LoggingConstant.MDC_ERROR,LoggingConstant.MDC_TRACE);
+                       String markerInputVal=markerInput;
+                       String marker="ENTRY";
+            
+                       Marker marker1=ACUMOSLogConstants.Markers.INVOKE_RETURN;
+                       
+                       MarkerFactory.getMarker(marker);
+                       System.out.println(MarkerFactory.getMarker(marker));
+                       
+                       MarkerFactory.getMarker(markerInputVal);
+            
+                       
+                       logger.info(marker1,"This is a confidential message....");
+                       
+                       Marker notifyAdmin = MarkerFactory.getMarker("NOTIFY_ADMIN");
+                       logger.error(notifyAdmin,
+                         "This is a serious an NOTIFY_ADMIN error requiring the admin's NOTIFY_ADMIN attention",
+                          new Exception("Just testing"));
+                       
+                       //Marker notifyAdmin = MarkerFactory.getMarker("NOTIFY_ADMIN");
+                       logger.error(MarkerFactory.getMarker(markerInputVal),
+                         "This is a serious an User Input Marker error requiring the admin's attention",
+                          new Exception("Just testing"));
+                       
+                       logger.info(InvocationMode.SYNCHRONOUS.getmMarker(), "platform-oam");
+                       logger.debug("Inside getWarn Service");
+                       LogConfig.getHostDetails();
+                       LogConfig.clearMDCDetails();
+           
+                   }
+                catch (Exception e) {            
+                  
+               }
+               return "";
+           }
+       
+       @ApiOperation(value = "Get Logging publish warn requests.")
+       @RequestMapping(value = { "/warn" }, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+       @ResponseBody
+       public String getWarn() throws Exception {
+               
+       //      LogConfig.setEnteringMDCs("first", "second","test",LoggingConstant.MDC_INPROGRESS,LoggingConstant.MDC_ERROR);
+               LogConfig.setEnteringMDCs("first", "second","","","");
+               logger.info(InvocationMode.SYNCHRONOUS.getmMarker(), "platform-oam");
+               logger.debug("Inside getWarn Service");
+               logger.info(InvocationMode.ASYNCHRONOUS.getmMarker(), "platform-oam");
+               logger.info("Inside getWarn Service");
+               String marker="ENTRY";
+       Marker marker1=ACUMOSLogConstants.Markers.INVOKE_RETURN;
+       logger.error(marker1,
+                 "This is a serious an error requiring the admin's attention",
+                  new Exception("Just testing"));
+       logger.info(marker1,"This is a confidential message....");
+       logger.debug(marker1,"This is a confidential message....");
+       
+       MarkerFactory.getMarker(marker);
+       
+       Marker notifyAdmin = MarkerFactory.getMarker("NOTIFY_ADMIN");
+       logger.error(notifyAdmin,
+         "This is a serious an error requiring the admin's attention",
+          new Exception("Just testing"));
+   
+               logger.info("method call ended.");
+               logger.warn("method call ended.");
+               LogConfig.getHostDetails();
+               LogConfig.clearMDCDetails();
+
+               return "";
+       }
+       
+       
+       
+}
diff --git a/logging-rest-library/src/main/resources/application.properties b/logging-rest-library/src/main/resources/application.properties
new file mode 100644 (file)
index 0000000..c15f791
--- /dev/null
@@ -0,0 +1,2 @@
+server.contextPath=/logging-rest-library
+
diff --git a/logging-rest-library/src/main/resources/logback.xml b/logging-rest-library/src/main/resources/logback.xml
new file mode 100644 (file)
index 0000000..d01e2d0
--- /dev/null
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- ===============LICENSE_START======================================================= 
+       Acumos =================================================================================== 
+       Copyright (C) 2019 AT&T Intellectual Property & Tech Mahindra. All rights 
+       reserved. =================================================================================== 
+       This Acumos software file is distributed by AT&T and Tech Mahindra 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 This file 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. ===============LICENSE_END========================================================= -->
+<configuration scan="true" scanPeriod="3 seconds" debug="false">
+
+       <!-- gather files in a subdirectory - usually a volume in docker -->
+       <property name="logDirPrefix" value="logs/platform-oam" />
+
+       <!-- component name is log file basename -->
+       <property name="componentName" value="elk-client"></property>
+
+       <!-- The directories where logs are written -->
+       <property name="logDirectory" value="${logDirPrefix}/${componentName}" />
+
+       <!-- Based on https://wiki.acumos.org/display/OAM/Acumos+Log+Standards -->
+       <property name="LogTimestamp"
+               value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;, UTC}" />
+       <property name="Level" value="%.-5level" />
+       <property name="Logger" value="%logger" />
+       <property name="Mdc"
+               value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n','\\\\n'}" />
+       <property name="Marker"
+               value="%replace(%replace(%marker){'\t','\\\\t'}){'\n','\\\\n'}" />
+       <property name="Thread" value="%thread" />
+       <property name="Message"
+               value="%replace(%replace(%msg){'\t','\\\\t'}){'\n','\\\\n'}" />
+       <!-- Gather exception stack trace with no linebreaks -->
+       <property name="Exception"
+               value="%replace(%replace(%ex){'\t', '\\\\t'}){'\n','\\\\n'}" />
+
+
+       <!-- Use %nopexception to disable Logback default behavior of appending 
+               %ex -->
+
+       <property name="singleLineBoreasPattern"
+               value="%nopexception${LogTimestamp}\t${Thread}\t${Level}\t${Logger}\t${Marker}\t${Mdc}\t${Message}\t${Exception}%n" />
+       <property name="multiLineBoreasPattern"
+               value="${LogTimestamp}\t${Thread}\t${Level}\t${Logger}\t${Marker}\t${Mdc}\t%msg\t%ex%n" />
+
+       <!-- Uncomment below code for filter if need to show events with level WARN 
+               or above on the console (docker log) -->
+       <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+               <!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>WARN</level> 
+                       </filter> -->
+               <encoder>
+                       <pattern>${multiLineBoreasPattern}</pattern>
+               </encoder>
+       </appender>
+
+       <!-- Show all events in the rolling log file -->
+       <appender name="file-rolling"
+               class="ch.qos.logback.core.rolling.RollingFileAppender">
+               <file>${logDirectory}/${componentName}.log</file>
+               <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+                       <!-- daily rollover -->
+                       <fileNamePattern>${logDirectory}/${componentName}.%d{yyyy-MM-dd}.log.zip
+                       </fileNamePattern>
+                       <!-- keep 30 days' worth of history capped at 3GB total size -->
+                       <maxHistory>30</maxHistory>
+                       <totalSizeCap>3GB</totalSizeCap>
+               </rollingPolicy>
+               <encoder>
+                       <pattern>${singleLineBoreasPattern}</pattern>
+               </encoder>
+       </appender>
+       <appender name="file-async" class="ch.qos.logback.classic.AsyncAppender">
+               <queueSize>256</queueSize>
+               <includeCallerData>true</includeCallerData>
+               <appender-ref ref="file-rolling" />
+       </appender>
+
+       <!-- The root level is the default for all loggers, NOT a filter on any 
+               appender. This level can be set with property logging.level.root=LEVEL. -->
+       <root level="DEBUG">
+               <appender-ref ref="file-async" />
+               <appender-ref ref="STDOUT" />
+       </root>
+</configuration>