summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/pages.module.ts4
-rw-r--r--ecomp-sdk/epsdk-app-os/src/main/resources/logback.xml43
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/admin.module.ts5
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.html4
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.scss10
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.html2
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.scss5
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/conf/AppConfig.java3
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java8
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/util/SystemProperties.java4
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegateTest.java5
-rw-r--r--ecomp-sdk/epsdk-logger/pom.xml39
-rw-r--r--ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/format/AlarmSeverityEnum.java1
-rw-r--r--ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegate.java85
-rw-r--r--ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/LoggerProperties.java107
15 files changed, 228 insertions, 97 deletions
diff --git a/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/pages.module.ts b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/pages.module.ts
index 2ee9957f..fb5f8130 100644
--- a/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/pages.module.ts
+++ b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/pages.module.ts
@@ -5,7 +5,6 @@ import {PagesRoutingModule} from './pages-routing.module';
import {ReactiveFormsModule, FormsModule} from '@angular/forms';
import {HttpClientModule} from '@angular/common/http';
import {MaterialModule} from '../material-module';
-import {InformationModalComponent} from '../modals/information-modal/information-modal.component';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
import {MatTooltipModule} from '@angular/material/tooltip';
import {MatExpansionModule} from '@angular/material/expansion';
@@ -64,7 +63,6 @@ import {RefreshComponent} from './refresh/refresh.component';
declarations: [
PagesComponent,
SearchComponent,
- InformationModalComponent,
ConfirmationModalComponent,
SelfComponent,
SuccessModalComponent,
@@ -135,7 +133,7 @@ import {RefreshComponent} from './refresh/refresh.component';
jqxChartModule,
RdpModule
],
- entryComponents: [DialogOverviewExampleDialog, InformationModalComponent, SuccessModalComponent, ErrorModalComponent, SelfComponent, ConfirmationModalComponent],
+ entryComponents: [DialogOverviewExampleDialog, SuccessModalComponent, ErrorModalComponent, SelfComponent, ConfirmationModalComponent],
exports: [
],
providers: []
diff --git a/ecomp-sdk/epsdk-app-os/src/main/resources/logback.xml b/ecomp-sdk/epsdk-app-os/src/main/resources/logback.xml
index 3274c359..0c8ff5b1 100644
--- a/ecomp-sdk/epsdk-app-os/src/main/resources/logback.xml
+++ b/ecomp-sdk/epsdk-app-os/src/main/resources/logback.xml
@@ -48,6 +48,9 @@
<!-- specify the component name -->
<property name="componentName" value="epsdk_app_os"></property>
+ <!-- specify the application name -->
+ <property name="application_name" value="PortalSDK"></property>
+
<!-- specify the base path of the log directory -->
<property name="logDirPrefix" value="${catalina.base}/logs"></property>
@@ -78,7 +81,7 @@
value="%X{MetricsLogBeginTimestamp}|%X{MetricsLogEndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{ClientIPAddress}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{TargetVisualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}| %msg%n" />
<property name="errorLoggerPattern"
- value="%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{ClassName}|%X{AlertSeverity}|%X{ErrorCode}|%X{ErrorDescription}| %msg%n" />
+ value="%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{AlertSeverity}|%X{ErrorCode}|%X{ErrorDescription}| %msg%n" />
<property name="defaultLoggerPattern"
value="%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%thread|%X{ClassName}| %msg%n" />
@@ -339,33 +342,27 @@
<appender name="asyncEELFDebug" class="ch.qos.logback.classic.AsyncAppender">
<queueSize>256</queueSize>
<appender-ref ref="EELFDebug" />
- </appender>
+ </appender>
+
+ <logger name="EELFAudit" level="info" additivity="false">
+ <appender-ref ref="asyncEELFAudit" />
+ </logger>
-
+ <logger name="EELFMetrics" level="info" additivity="false">
+ <appender-ref ref="asyncEELFMetrics" />
+ </logger>
-
- <logger name="org.onap.eelf" level="info" additivity="false">
- <appender-ref ref="asyncEELF" />
- </logger>
-
- <logger name="org.onap.eelf.audit" level="info" additivity="false">
- <appender-ref ref="asyncEELFAudit" />
- </logger>
-
- <logger name="org.onap.eelf.debug" level="debug" additivity="false">
- <appender-ref ref="asyncEELFDebug" />
- </logger>
-
- <logger name="org.onap.eelf.error" level="info" additivity="false">
- <appender-ref ref="asyncEELFError" />
- </logger>
-
- <logger name="org.onap.eelf.metrics" level="info" additivity="false">
- <appender-ref ref="asyncEELFMetrics" />
- </logger>
+ <logger name="EELFError" level="info" additivity="false">
+ <appender-ref ref="asyncEELFError" />
+ </logger>
+
+ <logger name="com.att.eelf.debug" level="debug" additivity="false">
+ <appender-ref ref="asyncEELFDebug" />
+ </logger>
<root level="DEBUG">
<appender-ref ref="asyncEELF" />
+ <appender-ref ref="STDOUT" />
</root>
</configuration>
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/admin.module.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/admin.module.ts
index ba546647..57554de5 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/admin.module.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/admin.module.ts
@@ -20,9 +20,10 @@ import {RoleFunctionsComponent} from './role-functions/role-functions.component'
import {RolesComponent} from './roles/roles.component';
import {NewRoleComponent} from './roles/new-role/new-role.component'
import { UserService } from '../shared/services/user/user.service';
+import { InformationModalComponent } from '../modals/information-modal/information-modal.component';
@NgModule({
- declarations: [AdminComponent, CacheAdminComponent, RoleFunctionsComponent, RolesComponent, NewRoleComponent],
+ declarations: [AdminComponent, CacheAdminComponent, RoleFunctionsComponent, RolesComponent, NewRoleComponent, InformationModalComponent],
imports: [
CommonModule,
MenusModule,
@@ -38,7 +39,7 @@ import { UserService } from '../shared/services/user/user.service';
MatPaginatorModule,
MatInputModule
],
- entryComponents: [NewRoleComponent],
+ entryComponents: [NewRoleComponent, InformationModalComponent],
exports: [
],
providers: [UserService]
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.html
index c86a0693..f91e8821 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.html
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.html
@@ -1,5 +1,5 @@
<div class="sidebar" [ngClass]="{'siderbar-height': showHeader, 'siderbar-height-noHeader': !showHeader}" >
- <div class="sidebar-list" [ngClass]="{collapsed: collapsed}">
+ <div class="sidebar-list" [ngClass]="{collapsed: collapsed, 'remove-header-margin': showHeader == false}">
<nav [ngClass]="{sidebarPushRight: isActive, collapsed: collapsed}">
@@ -47,7 +47,7 @@
</div>
</nav>
</div>
- <div class="toggle-button" [ngClass]="{collapsed: collapsed}" (click)="toggleCollapsed()">
+ <div class="toggle-button" [ngClass]="{collapsed: collapsed, 'toggle-button-no-header': showHeader == false }" (click)="toggleCollapsed()">
<!-- <i class="fa fa-angle-double-{{collapsed?'right':'left'}}"></i>&nbsp; -->
<i class="icon ion-md-arrow-{{collapsed?'dropright':'dropleft'}}" style="float:right"></i>
<i class="icon ion-md-arrow-{{collapsed?'dropright':'dropleft'}}" style="float:right"></i>&nbsp;
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.scss b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.scss
index 59b7e347..50bc1b5f 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.scss
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.scss
@@ -153,6 +153,10 @@
}
}
}
+
+ .remove-header-margin{
+ top: 4.2em;
+ }
.nested-menu {
.list-group-item {
@@ -215,7 +219,7 @@
}
.toggle-button {
position: fixed;
- width: 236px;
+ width: 235px;
cursor: pointer;
padding: 12px;
// bottom: 5.5em;
@@ -238,6 +242,10 @@
-o-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
+
+ .toggle-button-no-header{
+ top: 8px;
+ }
.collapsed {
width: 60px;
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.html
index bf4507f6..2ae6c463 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.html
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.html
@@ -4,7 +4,7 @@
</section>
</div>
-<section class="main-container" [ngClass]="{collapsed: collapedSideBar}">
+<section class="main-container" [ngClass]="{'collapsed': collapedSideBar , 'remove-header': showHeader == false }">
<app-sidebar (collapsedEvent)="receiveCollapsed($event)"></app-sidebar>
<router-outlet></router-outlet>
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.scss b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.scss
index 561f493b..141da812 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.scss
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.scss
@@ -52,6 +52,11 @@
position: relative;
overflow: hidden;
}
+
+.remove-header{
+ margin-top: -9px;
+}
+
.collapsed {
margin-left: 60px;
}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/conf/AppConfig.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/conf/AppConfig.java
index b1a0b0b8..cc0fca29 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/conf/AppConfig.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/conf/AppConfig.java
@@ -112,8 +112,7 @@ public class AppConfig extends WebMvcConfigurerAdapter implements Configurable,
* each log file type that logging has been started.
*/
private void initGlobalLocalContext() {
- String appName = SystemProperties.getProperty(SystemProperties.APPLICATION_NAME);
- logger.init(appName);
+ logger.init();
}
/**
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java
index 6a5fe469..8e21fd2c 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java
@@ -37,7 +37,6 @@
*/
package org.onap.portalsdk.core.logging.aspect;
-import static com.att.eelf.configuration.Configuration.MDC_INSTANCE_UUID;
import static com.att.eelf.configuration.Configuration.MDC_SERVER_FQDN;
import static com.att.eelf.configuration.Configuration.MDC_SERVER_IP_ADDRESS;
import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME;
@@ -50,8 +49,6 @@ import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import org.onap.portalsdk.core.domain.User;
-import org.onap.portalsdk.core.exception.SessionExpiredException;
-import org.onap.portalsdk.core.logging.format.AlarmSeverityEnum;
import org.onap.portalsdk.core.logging.format.AuditLogFormatter;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.logging.logic.LoggerProperties;
@@ -113,10 +110,9 @@ public class EELFLoggerAdvice {
}
// Initialize Request defaults only for controller methods.
- MDC.put(MDC_SERVICE_NAME, SystemProperties.getProperty(SystemProperties.APPLICATION_NAME));
+ MDC.put(MDC_SERVICE_NAME, LoggerProperties.getPropertyValue(LoggerProperties.APP_NAME));
MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName());
MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress());
- MDC.put(MDC_INSTANCE_UUID, LoggerProperties.getProperty(LoggerProperties.INSTANCE_UUID));
MDC.put(className + methodName + SystemProperties.METRICSLOG_BEGIN_TIMESTAMP, getCurrentDateTimeUTC());
MDC.put(SystemProperties.METRICSLOG_BEGIN_TIMESTAMP, getCurrentDateTimeUTC());
MDC.put(SystemProperties.AUDITLOG_BEGIN_TIMESTAMP, getCurrentDateTimeUTC());
@@ -207,7 +203,7 @@ public class EELFLoggerAdvice {
if (MDC.get(SystemProperties.PARTNER_NAME) == null|| MDC.get(SystemProperties.PARTNER_NAME).isEmpty()){
MDC.put(SystemProperties.PARTNER_NAME, "Unknown");
}
- MDC.put(MDC_SERVICE_NAME, SystemProperties.getProperty(SystemProperties.APPLICATION_NAME));
+ MDC.put(MDC_SERVICE_NAME, LoggerProperties.getPropertyValue(LoggerProperties.APP_NAME));
MDC.put(SystemProperties.STATUS_CODE, result);
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/util/SystemProperties.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/util/SystemProperties.java
index 0ce15b77..d3827d95 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/util/SystemProperties.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/util/SystemProperties.java
@@ -347,8 +347,8 @@ public class SystemProperties {
*
* @return Application name
*/
- public static String getApplicationName() {
- return getProperty(APPLICATION_NAME);
+ public String getApplicationName() {
+ return getProperty(APPLICATION_NAME);
}
/**
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegateTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegateTest.java
index 2d1187f9..0d0bea73 100644
--- a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegateTest.java
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegateTest.java
@@ -241,9 +241,8 @@ public class EELFLoggerDelegateTest {
@Test
public void initTest(){
EELFLoggerDelegate eelFLoggerDelegate = new EELFLoggerDelegate(getClass().getName());
- String appName = "PortalSDK";
- eelFLoggerDelegate.init(appName);
- Assert.assertTrue(true);
+ eelFLoggerDelegate.init();
+ Assert.assertTrue(true);
}
@Test
diff --git a/ecomp-sdk/epsdk-logger/pom.xml b/ecomp-sdk/epsdk-logger/pom.xml
index e5a3a373..0a4ac842 100644
--- a/ecomp-sdk/epsdk-logger/pom.xml
+++ b/ecomp-sdk/epsdk-logger/pom.xml
@@ -1,20 +1,22 @@
-<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>
+<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>
- <parent>
+ <parent>
<groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-project</artifactId>
<version>3.4.0-SNAPSHOT</version>
- </parent>
-
- <groupId>org.onap.portal.sdk</groupId>
- <artifactId>epsdk-logger</artifactId>
- <version>3.4.0-SNAPSHOT</version>
+ </parent>
- <name>ONAP Portal SDK Logger</name>
-
- <dependencies>
- <dependency>
+ <groupId>org.onap.portal.sdk</groupId>
+ <artifactId>epsdk-logger</artifactId>
+ <version>3.4.0-SNAPSHOT</version>
+
+ <name>ONAP Portal SDK Logger</name>
+
+ <dependencies>
+ <dependency>
<groupId>com.att.eelf</groupId>
<artifactId>eelf-core</artifactId>
<version>1.0.0</version>
@@ -24,5 +26,16 @@
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
- </dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>${springframework.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
</project>
diff --git a/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/format/AlarmSeverityEnum.java b/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/format/AlarmSeverityEnum.java
index 2eda82b0..80dbabde 100644
--- a/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/format/AlarmSeverityEnum.java
+++ b/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/format/AlarmSeverityEnum.java
@@ -42,6 +42,7 @@ public enum AlarmSeverityEnum {
MAJOR("2"),
MINOR("3"),
INFORMATIONAL("4"),
+ ERROR("5"),
NONE("0");
private final String severity;
diff --git a/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegate.java b/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegate.java
index adad5caa..45eae6d4 100644
--- a/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegate.java
+++ b/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegate.java
@@ -38,7 +38,6 @@
package org.onap.portalsdk.core.logging.logic;
import static com.att.eelf.configuration.Configuration.MDC_ALERT_SEVERITY;
-import static com.att.eelf.configuration.Configuration.MDC_INSTANCE_UUID;
import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;
import static com.att.eelf.configuration.Configuration.MDC_SERVER_FQDN;
import static com.att.eelf.configuration.Configuration.MDC_SERVER_IP_ADDRESS;
@@ -60,7 +59,6 @@ import org.onap.portalsdk.core.logging.format.AppMessagesEnum;
import org.onap.portalsdk.core.logging.format.ErrorSeverityEnum;
import org.slf4j.MDC;
-import com.att.eelf.configuration.Configuration;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.att.eelf.configuration.SLF4jWrapper;
@@ -115,17 +113,39 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
public void logWrite(EELFLogger logger, Level level, String msg, Throwable th, Object... arguments) {
MDC.put(LoggerProperties.MDC_CLASS_NAME, className);
setGlobalLoggingContext();
+ String requestId = null;
+ if (MDC.get(MDC_KEY_REQUEST_ID) == null||MDC.get(MDC_KEY_REQUEST_ID).isEmpty()){
+ requestId = UUID.randomUUID().toString();
+ MDC.put(MDC_KEY_REQUEST_ID, requestId);
+ }
+
if ( logger == errorLogger) {
- MDC.put(LoggerProperties.MDC_CLASS_NAME, className);
- MDC.put("ErrorCategory", ErrorSeverityEnum.ERROR.name());
- MDC.put("ErrorCode", "900");
- MDC.put("ErrorDescription", "Exception");
+ if(MDC.get(LoggerProperties.MDC_CLASS_NAME) == null) {
+ MDC.put(LoggerProperties.MDC_CLASS_NAME, className);
+ }
+ MDC.put(MDC_ALERT_SEVERITY, AlarmSeverityEnum.ERROR.name());
+ if(MDC.get(LoggerProperties.ERROR_CODE) == null) {
+ MDC.put(LoggerProperties.ERROR_CODE, "900");
+ }
+ if(MDC.get(LoggerProperties.ERROR_DESCRIPTION) == null) {
+ MDC.put(LoggerProperties.ERROR_DESCRIPTION, "Exception");
+ }
}
- if (MDC.get(Configuration.MDC_KEY_REQUEST_ID) == null||MDC.get(Configuration.MDC_KEY_REQUEST_ID).isEmpty()){
- String requestId = UUID.randomUUID().toString();
- MDC.put(Configuration.MDC_KEY_REQUEST_ID, requestId);
+ if(MDC.get(LoggerProperties.PARTNER_NAME) == null) {
+ MDC.put(LoggerProperties.PARTNER_NAME, "UNKNOWN");
+ }
+
+ if(MDC.get(LoggerProperties.STATUS_CODE) == null) {
+ MDC.put(LoggerProperties.STATUS_CODE, "COMPLETE");
+ }
+
+ if ( logger == auditLogger) {
+ MDC.put(LoggerProperties.MDC_CLASS_NAME, className);
+ this.calculateDateTimeDifference(MDC.get(LoggerProperties.AUDITLOG_BEGIN_TIMESTAMP), MDC.get(LoggerProperties.AUDITLOG_END_TIMESTAMP));
+ MDC.put(LoggerProperties.CUSTOM_FIELD1, "EXIT");
+ MDC.put(LoggerProperties.CUSTOM_FIELD2, "InvocationID=" + requestId);
}
if (logger.isErrorEnabled()) {
@@ -135,12 +155,18 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
}
if ( logger == errorLogger) {
- MDC.remove(MDC_SERVICE_NAME);
MDC.remove(LoggerProperties.MDC_CLASS_NAME);
- MDC.remove("ErrorCode");
- MDC.remove("ErrorDescription");
- MDC.remove("ErrorCategory");
+ MDC.remove(LoggerProperties.ERROR_CATAGORY);
+ MDC.remove(LoggerProperties.ERROR_CODE);
+ MDC.remove(LoggerProperties.ERROR_DESCRIPTION);
}
+
+ if(logger == auditLogger) {
+ MDC.remove(LoggerProperties.MDC_CLASS_NAME);
+ MDC.remove(LoggerProperties.CUSTOM_FIELD1);
+ MDC.remove(LoggerProperties.CUSTOM_FIELD2);
+ }
+ MDC.remove(MDC_KEY_REQUEST_ID);
}
@@ -322,9 +348,8 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
/**
* Initializes the logger context.
*/
- public void init(String appName) {
+ public void init() {
setGlobalLoggingContext();
- MDC.put(MDC_SERVICE_NAME, appName);
}
public static String getCurrentDateTimeUTC() {
@@ -345,9 +370,9 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
AlarmSeverityEnum alarmSeverityEnum = epMessageEnum.getAlarmSeverity();
ErrorSeverityEnum errorSeverityEnum = epMessageEnum.getErrorSeverity();
- MDC.put(MDC_ALERT_SEVERITY, alarmSeverityEnum.name());
- MDC.put("ErrorCode", epMessageEnum.getErrorCode());
- MDC.put("ErrorDescription", epMessageEnum.getErrorDescription());
+ MDC.put(MDC_ALERT_SEVERITY, alarmSeverityEnum.severity());
+ MDC.put(LoggerProperties.ERROR_CODE, epMessageEnum.getErrorCode());
+ MDC.put(LoggerProperties.ERROR_DESCRIPTION, epMessageEnum.getErrorDescription());
String resolution = this.formatMessage(epMessageEnum.getDetails() + " " + epMessageEnum.getResolution(),
(Object[]) param);
@@ -361,8 +386,8 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
} catch (Exception e) {
errorLogger.error("logEcompError failed", e);
} finally {
- MDC.remove("ErrorCode");
- MDC.remove("ErrorDescription");
+ MDC.remove(LoggerProperties.ERROR_CODE);
+ MDC.remove(LoggerProperties.ERROR_DESCRIPTION);
MDC.remove(MDC_ALERT_SEVERITY);
}
}
@@ -395,7 +420,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
try {
MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName());
MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress());
- MDC.put(MDC_INSTANCE_UUID, LoggerProperties.getProperty(LoggerProperties.INSTANCE_UUID));
+ MDC.put(MDC_SERVICE_NAME, LoggerProperties.getPropertyValue(LoggerProperties.APP_NAME));
} catch (Exception e) {
errorLogger.error("setGlobalLoggingContext failed", e);
}
@@ -484,4 +509,22 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger {
}
return "";
}
+
+ /**
+ *
+ * @param beginDateTime
+ * @param endDateTime
+ */
+ private void calculateDateTimeDifference(String beginDateTime, String endDateTime) {
+ if (beginDateTime != null && endDateTime != null) {
+ try {
+ Date beginDate = ecompLogDateFormat.parse(beginDateTime);
+ Date endDate = ecompLogDateFormat.parse(endDateTime);
+ String timeDifference = String.format("%d", endDate.getTime() - beginDate.getTime());
+ MDC.put(LoggerProperties.MDC_TIMER, timeDifference);
+ } catch (Exception e) {
+ errorLogger.error("calculateDateTimeDifference failed", e);
+ }
+ }
+ }
}
diff --git a/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/LoggerProperties.java b/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/LoggerProperties.java
index abd98b19..4287088b 100644
--- a/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/LoggerProperties.java
+++ b/ecomp-sdk/epsdk-logger/src/main/java/org/onap/portalsdk/core/logging/logic/LoggerProperties.java
@@ -37,13 +37,24 @@
*/
package org.onap.portalsdk.core.logging.logic;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.springframework.util.ResourceUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
public class LoggerProperties {
-
public static final String MDC_APPNAME = "AppName";
public static final String MDC_REST_PATH = "RestPath";
public static final String MDC_REST_METHOD = "RestMethod";
@@ -62,20 +73,34 @@ public class LoggerProperties {
public static final String CLIENT_IP_ADDRESS = "ClientIPAddress";
public static final String STATUS_CODE = "StatusCode";
public static final String RESPONSE_CODE = "ResponseCode";
-
+
public static final String HTTP = "HTTP";
public static final String HTTPS = "HTTPS";
public static final String UNKNOWN = "Unknown";
public static final String PROTOCOL = "PROTOCOL";
public static final String USERAGENT_NAME = "user-agent";
public static final String USER_ATTRIBUTE_NAME = "user_attribute_name";
-
- private LoggerProperties(){}
+ public static final String ALERT_SEVERITY = "AlertSeverity";
+ public static final String ERROR_CATAGORY = "ErrorCatagory";
+ public static final String ERROR_CODE = "ErrorCode";
+ public static final String ERROR_DESCRIPTION = "ErrorDescription";
+ public static final String CUSTOM_FIELD1 = "CustomField1";
+ public static final String CUSTOM_FIELD2 = "CustomField2";
+ public static final String APP_NAME = "application_name";
+
+ private LoggerProperties() {
+ }
+
+ private static Properties properties;
+
+ private static DocumentBuilderFactory dbFactory;
+
+ private static DocumentBuilder dBuilder;
+
+ private static Document doc;
- private static Properties properties;
-
- private static String propertyFileName = "logger.properties";
+ private static String propertyFileName = "classpath:logback.xml";
private static final Object lockObject = new Object();
@@ -83,8 +108,7 @@ public class LoggerProperties {
* Gets the property value for the specified key. If a value is found, leading
* and trailing space is trimmed.
*
- * @param property
- * Property key
+ * @param property Property key
* @return Value for the named property; null if the property file was not
* loaded or the key was not found.
*/
@@ -113,21 +137,68 @@ public class LoggerProperties {
* whether the properties file can be loaded successfully.
*
* @return True if properties were successfully loaded, else false.
- * @throws IOException
- * On failure
+ * @throws IOException On failure
+ * @throws SAXException
+ * @throws ParserConfigurationException
*/
private static boolean initialize() throws IOException {
- if (properties != null)
+ File xmlFile = null;
+// if (properties != null)
+// return true;
+// InputStream in = LoggerProperties.class.getClassLoader().getResourceAsStream(propertyFileName);
+
+ if (dbFactory != null)
return true;
- InputStream in = LoggerProperties.class.getClassLoader().getResourceAsStream(propertyFileName);
- if (in == null)
- return false;
- properties = new Properties();
+// if (in == null)
+// return false;
+ if (dbFactory == null)
+// properties = new Properties();
+ dbFactory = DocumentBuilderFactory.newInstance();
try {
- properties.load(in);
+// properties.load(in);
+ xmlFile = ResourceUtils.getFile(propertyFileName);
+ dBuilder = dbFactory.newDocumentBuilder();
+ doc = dBuilder.parse(xmlFile);
+ doc.getDocumentElement().normalize();
+ } catch (IOException | SAXException | ParserConfigurationException e) {
+ return false;
} finally {
- in.close();
+// in.close();
}
return true;
}
+
+ public static String getPropertyValue(String propertyName) {
+
+ if (dbFactory == null) {
+ synchronized (lockObject) {
+ try {
+ if (!initialize()) {
+ return null;
+ }
+ } catch (IOException e) {
+ return null;
+ }
+ }
+ }
+ String value = getValue(doc, propertyName);
+ if (value != null)
+ value = value.trim();
+ return value;
+
+ }
+
+ private static String getValue(Document someNode, String property) {
+ NodeList nodeList = someNode.getElementsByTagName("property");
+ String Value = null;
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node node = nodeList.item(i);
+ if (node instanceof Element) {
+ if (((Element) node).getAttribute("name").toString().equals(property)) {
+ Value = ((Element) node).getAttribute("value").toString();
+ }
+ }
+ }
+ return Value;
+ }
} \ No newline at end of file