diff options
Diffstat (limited to 'operation-utils/src/main/resources')
6 files changed, 445 insertions, 43 deletions
diff --git a/operation-utils/src/main/resources/GenericMessages.properties b/operation-utils/src/main/resources/GenericMessages.properties index b7322f8..d3dc81a 100644 --- a/operation-utils/src/main/resources/GenericMessages.properties +++ b/operation-utils/src/main/resources/GenericMessages.properties @@ -41,7 +41,12 @@ GENERAL_ERROR=\ ECOMP-GENERAL-ERROR-5403|\ {0}|\ Please check other logs for more detailed info|\ - General error + General error +GENERAL_EXCEPTION=\ + ECOMP-GENERAL-ERROR-5404|\ + {0}|\ + Please check other logs for more detailed info|\ + General exception AUDIT_BEGIN=\ ECOMP-GENERAL-5403|\ Entering method|\ @@ -62,4 +67,8 @@ METRICS_END=\ Exiting method|\ No resolution needed|\ Exiting method - +MISSING_REQUESTID=\ + ECOMP-MISSING_REQUESTID-5404|\ + from {0}|\ + No resolution needed|\ + missing request id diff --git a/operation-utils/src/main/resources/GenericMessages.yaml b/operation-utils/src/main/resources/GenericMessages.yaml index df592e2..71624d6 100644 --- a/operation-utils/src/main/resources/GenericMessages.yaml +++ b/operation-utils/src/main/resources/GenericMessages.yaml @@ -1,36 +1,65 @@ -GENERAL_ERROR: - errorCode: ECOMP-GENERAL-ERROR-5403 - messageFormat: '{0}' - resolution: Please check other logs for more detailed info - description: General error -GENERAL_INFO: - errorCode: ECOMP-GENERAL-INFO-5401 - messageFormat: '{0}' - resolution: Please check other logs for more detailed info - description: General info -GENERAL_WARNING: - errorCode: ECOMP-GENERAL-WARNING-5402 - messageFormat: '{0}' - resolution: Please check other logs for more detailed info - description: General warning -METRICS_END: - errorCode: ECOMP-GENERAL-5404 - messageFormat: Exiting method - resolution: No resolution needed - description: Exiting method -AUDIT_END: - errorCode: ECOMP-GENERAL-5404 - messageFormat: Exiting method - resolution: No resolution needed - description: Exiting method -AUDIT_BEGIN: - errorCode: ECOMP-GENERAL-5403 - messageFormat: Entering method - resolution: No resolution needed - description: Entering method -METRICS_BEGIN: - errorCode: ECOMP-GENERAL-5403 - messageFormat: Entering method - resolution: No resolution needed - description: Entering method +package-name: org.openecomp.logger +java-root: src/main/java-gen +resources-root: src/main/resources-gen +messages: + ECOMP-GENERAL-EXCEPTION: + errorCode: 5404W + messageFormat: "{0}" + resolution: Please check other logs for more detailed info + description: General exception + ECOMP-GENERAL-ERROR: + errorCode: 5403E + messageFormat: "{0}" + resolution: Please check other logs for more detailed info + description: General error + ECOMP-GENERAL-INFO: + errorCode: 5401I + messageFormat: "{0}" + resolution: Please check other logs for more detailed info + description: General info + ECOMP-GENERAL-WARNING: + errorCode: 5402W + messageFormat: "{0}" + resolution: Please check other logs for more detailed info + description: General warning + ECOMP-REMOTE-CALL-OK: + errorCode: 2000I + messageFormat: "" + resolution: No resolution needed + description: Remote Call Succeess + ECOMP-REQUEST-OK: + errorCode: 2000I + messageFormat: "" + resolution: No resolution needed + description: Request Success + ECOMP-REMOTE-CALL-ERROR: + errorCode: 4000W + messageFormat: "{0}" + resolution: No resolution needed + description: Remote Call Failed + ECOMP-REQUEST-ERROR: + errorCode: 4000I + messageFormat: "{0}" + resolution: No resolution needed + description: Request Failed + ECOMP-MISSING-REQUESTID: + errorCode: 3401W + messageFormat: Missing request id from {0} + resolution: Need to get north bound entity to provide request ID per ECOMP logging requirements + description: Got a north bound request that was missing a request ID. + ECOMP-LOGGER-NON-EMPTY-STACK: + errorCode: 4401W + messageFormat: "" + resolution: Development bug. + description: Component recorded an Audit End with an non empty stack + ECOMP-LOGGER-POP-ON-EMPTY-STACK: + errorCode: 4402W + messageFormat: "" + resolution: Development bug. + description: Component performed a Pop on empty stack + ECOMP-LOGGER-TOP-ON-EMPTY-STACK: + errorCode: 4403W + messageFormat: "" + resolution: Development bug. + description: Component performed a Top on empty stack
\ No newline at end of file diff --git a/operation-utils/src/main/resources/logback.xml b/operation-utils/src/main/resources/logback.xml new file mode 100644 index 0000000..5dde533 --- /dev/null +++ b/operation-utils/src/main/resources/logback.xml @@ -0,0 +1,351 @@ +<configuration scan="true" scanPeriod="3 seconds"> + <!--<jmxConfigurator /> --> + <!-- directory path for all other type logs --> + <property name="logDir" value="logs" /> + + <!-- directory path for debugging type logs --> + <property name="debugDir" value="debug-logs" /> + + <!-- specify the component name --> + <property name="componentName" value="EELF"></property> + + <!-- log file names --> + <property name="generalLogName" value="application" /> + <property name="securityLogName" value="security" /> + <property name="performanceLogName" value="performance" /> + <property name="serverLogName" value="server" /> + <property name="policyLogName" value="policy" /> + <property name="errorLogName" value="error" /> + <property name="metricsLogName" value="metrics" /> + <property name="auditLogName" value="audit" /> + <property name="debugLogName" value="debug" /> + + <property name="defaultPattern" value="%date{ISO8601,UTC}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Timer}| %msg%n" /> + + <property name="auditLoggerPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}| %msg%n" /> + <property name="metricsLoggerPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%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{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}| %msg%n" /> + <property name="errorLoggerPattern" value="%date{ISO8601,UTC}|%X{RequestId}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode}|%X{ErrorDescription}| %msg%n" /> + <property name="debugLoggerPattern" value="%date{ISO8601,UTC}|%X{RequestId}| %msg%n" /> + + <property name="logDirectory" value="${logDir}/${componentName}" /> + <property name="debugLogDirectory" value="${debugDir}/${componentName}" /> + + + <!-- Example evaluator filter applied against console appender --> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>${defaultPattern}</pattern> + </encoder> + </appender> + + <!-- ============================================================================ --> + <!-- EELF Appenders --> + <!-- ============================================================================ --> + + <!-- The EELFAppender is used to record events to the general application + log --> + + + <appender name="EELF" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${logDirectory}/${generalLogName}.log</file> + <rollingPolicy + class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${logDirectory}/${generalLogName}.%i.log.zip + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>20</maxIndex> + </rollingPolicy> + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>2500KB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>${defaultPattern}</pattern> + </encoder> + </appender> + + <appender name="asyncEELF" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="EELF" /> + </appender> + + <!-- EELF Security Appender. This appender is used to record security events + to the security log file. Security events are separate from other loggers + in EELF so that security log records can be captured and managed in a secure + way separate from the other logs. This appender is set to never discard any + events. --> + <appender name="EELFSecurity" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${logDirectory}/${securityLogName}.log</file> + <rollingPolicy + class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${logDirectory}/${securityLogName}.%i.log.zip + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>20</maxIndex> + </rollingPolicy> + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>2500KB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>${defaultPattern}</pattern> + </encoder> + </appender> + + <appender name="asyncEELFSecurity" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <discardingThreshold>0</discardingThreshold> + <appender-ref ref="EELFSecurity" /> + </appender> + + <!-- EELF Performance Appender. This appender is used to record performance + records. --> + <appender name="EELFPerformance" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${logDirectory}/${performanceLogName}.log</file> + <rollingPolicy + class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${logDirectory}/${performanceLogName}.%i.log.zip + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>20</maxIndex> + </rollingPolicy> + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>2500KB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>${defaultPattern}</pattern> + </encoder> + </appender> + <appender name="asyncEELFPerformance" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="EELFPerformance" /> + </appender> + + <!-- EELF Server Appender. This appender is used to record Server related + logging events. The Server logger and appender are specializations of the + EELF application root logger and appender. This can be used to segregate Server + events from other components, or it can be eliminated to record these events + as part of the application root log. --> + <appender name="EELFServer" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${logDirectory}/${serverLogName}.log</file> + <rollingPolicy + class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${logDirectory}/${serverLogName}.%i.log.zip + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>20</maxIndex> + </rollingPolicy> + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>2500KB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>${defaultPattern}</pattern> + </encoder> + </appender> + <appender name="asyncEELFServer" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="EELFServer" /> + </appender> + + + <!-- EELF Policy Appender. This appender is used to record Policy engine + related logging events. The Policy logger and appender are specializations + of the EELF application root logger and appender. This can be used to segregate + Policy engine events from other components, or it can be eliminated to record + these events as part of the application root log. --> + <appender name="EELFPolicy" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${logDirectory}/${policyLogName}.log</file> + <rollingPolicy + class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${logDirectory}/${policyLogName}.%i.log.zip + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>20</maxIndex> + </rollingPolicy> + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>2500KB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>${defaultPattern}</pattern> + </encoder> + </appender> + <appender name="asyncEELFPolicy" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="EELFPolicy" /> + </appender> + + + <!-- EELF Audit Appender. This appender is used to record audit engine + related logging events. The audit logger and appender are specializations + of the EELF application root logger and appender. This can be used to segregate + Policy engine events from other components, or it can be eliminated to record + these events as part of the application root log. --> + + <appender name="EELFAudit" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${logDirectory}/${auditLogName}.log</file> + <rollingPolicy + class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${logDirectory}/${auditLogName}.%i.log.zip + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>20</maxIndex> + </rollingPolicy> + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>2500KB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>${auditLoggerPattern}</pattern> + </encoder> + </appender> + <appender name="asyncEELFAudit" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="EELFAudit" /> + </appender> + + <appender name="EELFMetrics" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${logDirectory}/${metricsLogName}.log</file> + <rollingPolicy + class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${logDirectory}/${metricsLogName}.%i.log.zip + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>20</maxIndex> + </rollingPolicy> + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>2500KB</maxFileSize> + </triggeringPolicy> + <encoder> + <!-- <pattern>"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - + %msg%n"</pattern> --> + <pattern>${metricsLoggerPattern}</pattern> + </encoder> + </appender> + + + <appender name="asyncEELFMetrics" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="EELFMetrics"/> + </appender> + + <appender name="EELFError" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${logDirectory}/${errorLogName}.log</file> + <rollingPolicy + class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${logDirectory}/${errorLogName}.%i.log.zip + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>20</maxIndex> + </rollingPolicy> + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>2500KB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>${errorLoggerPattern}</pattern> + </encoder> + </appender> + + <appender name="asyncEELFError" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="EELFError"/> + </appender> + + <appender name="EELFDebug" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${debugLogDirectory}/${debugLogName}.log</file> + <rollingPolicy + class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${debugLogDirectory}/${debugLogName}.%i.log.zip + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>20</maxIndex> + </rollingPolicy> + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>2500KB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>${debugLoggerPattern}</pattern> + </encoder> + </appender> + + <appender name="asyncEELFDebug" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="EELFDebug" /> + <includeCallerData>true</includeCallerData> + </appender> + + + <!-- ============================================================================ --> + <!-- EELF loggers --> + <!-- ============================================================================ --> + <logger name="com.att.eelf" level="info" additivity="false"> + <appender-ref ref="asyncEELF" /> + </logger> + <logger name="com.att.eelf.security" level="info" additivity="false"> + <appender-ref ref="asyncEELFSecurity" /> + </logger> + <logger name="com.att.eelf.perf" level="info" additivity="false"> + <appender-ref ref="asyncEELFPerformance" /> + </logger> + <logger name="com.att.eelf.server" level="info" additivity="false"> + <appender-ref ref="asyncEELFServer" /> + </logger> + <logger name="com.att.eelf.policy" level="info" additivity="false"> + <appender-ref ref="asyncEELFPolicy" /> + </logger> + + <logger name="com.att.eelf.audit" level="info" additivity="false"> + <appender-ref ref="asyncEELFAudit" /> + </logger> + + <logger name="com.att.eelf.metrics" level="info" additivity="false"> + <appender-ref ref="asyncEELFMetrics" /> + </logger> + + + <logger name="com.att.eelf.error" level="info" additivity="false"> + <appender-ref ref="asyncEELFError" /> + </logger> + + <logger name="com.att.eelf.debug" level="debug" additivity="false"> + <appender-ref ref="asyncEELFDebug" /> + </logger> + + + <logger name="com.att.ecomp.audit" level="info" additivity="false"> + <appender-ref ref="asyncEELFAudit" /> + </logger> + + <logger name="com.att.ecomp.metrics" level="info" additivity="false"> + <appender-ref ref="asyncEELFMetrics" /> + </logger> + + + <logger name="com.att.ecomp.error" level="info" additivity="false"> + <appender-ref ref="asyncEELFError" /> + </logger> + + + <logger name="com.att.ecomp.debug" level="debug" additivity="false"> + <appender-ref ref="asyncEELFDebug" /> + </logger> + + <root level="INFO"> + <appender-ref ref="asyncEELF" /> + </root> + +</configuration>
\ No newline at end of file diff --git a/operation-utils/src/main/resources/messageEnum.java_template b/operation-utils/src/main/resources/messageEnum.java_template index e0b3c12..d6c7884 100644 --- a/operation-utils/src/main/resources/messageEnum.java_template +++ b/operation-utils/src/main/resources/messageEnum.java_template @@ -9,10 +9,10 @@ public enum ${name}MessageEnum implements EcompMessageEnum { def last messages.each { n, v -> last = n } messages.each { n, v -> %> - $n${n==last ? ";" : ","}\ + ${n.replace('-','_')}${n==last ? ";" : ","}\ <% } %> static { - EELFResourceManager.loadMessageBundle("${packageName}.$name"); + EELFResourceManager.loadMessageBundle("${resourcePath}/$name"); } } diff --git a/operation-utils/src/main/resources/operationEnum.java_template b/operation-utils/src/main/resources/operationEnum.java_template index 9ec9d3d..4bf3ec0 100644 --- a/operation-utils/src/main/resources/operationEnum.java_template +++ b/operation-utils/src/main/resources/operationEnum.java_template @@ -8,6 +8,19 @@ public enum ${name}OperationEnum implements EcompOperationEnum { def last operations.each { n, v -> last = n } operations.each { n, v -> %> - $n${n==last ? ";" : ","}\ -<% } %> + ${n.replaceAll('[-&@#:]','_')}("$n")${n==last ? "" : ","}\ +<% } %> ; + + + private String n; + + private ${name}OperationEnum(String n) { + this.n = n; + } + + @Override + public String toString() { + return n; + } + } diff --git a/operation-utils/src/main/resources/properties_template b/operation-utils/src/main/resources/properties_template index 76b2b48..fa25ca5 100644 --- a/operation-utils/src/main/resources/properties_template +++ b/operation-utils/src/main/resources/properties_template @@ -1,8 +1,8 @@ <% messages.each { n, v -> %> -$n=\\ - $v.errorCode|\\ +${n.replace('-','_')}=\\ + $n-$v.errorCode|\\ $v.messageFormat|\\ $v.resolution|\\ $v.description |