sekharhuawei | 39a0a2d | 2020-09-02 00:38:40 +0530 | [diff] [blame] | 1 | .. This work is licensed under a Creative Commons Attribution 4.0 International License. |
| 2 | .. http://creativecommons.org/licenses/by/4.0 |
| 3 | .. Copyright 2020 Huawei Technologies Co., Ltd. |
| 4 | |
| 5 | CXF-logging: |
| 6 | ============= |
| 7 | It is a logging framework from SO. Here basically we are having 2 interceptors which extends AbstractSoapInterceptor. |
| 8 | |
| 9 | SOAPLoggingInInterceptor: |
| 10 | +++++++++++++++++++++++++++ |
| 11 | |
| 12 | * This interceptor is responsible for Capturing requestId , client ip address , invocation id, service name, instance id, entry timestamp , log timestamp, Elapsed time for each request and update the MDC logger with staus In-progress. |
| 13 | |
| 14 | SOAPLoggingOutInterceptor: |
| 15 | ++++++++++++++++++++++++++++ |
| 16 | * This interceptor is responsible for log timestamp , elapsed time for each request and checks for if there is any exception update the MDC loggers with 500 response code otherwise update the status as completed. |
| 17 | |
| 18 | |
| 19 | cxf-logging Used By below components of SO: |
| 20 | ++++++++++++++++++++++++++++++++++++++++++++ |
| 21 | The cxf-logging framework is used by below components of so. |
| 22 | |
| 23 | mso-openstack-adapter. |
| 24 | mso-requests-db-adapter. |
| 25 | mso-sdnc-adapter. |
| 26 | mso-infrastructure-bpmn. |
| 27 | |
| 28 | cxf-logging dependency for using in other components: |
| 29 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 30 | |
| 31 | <dependency> |
| 32 | <groupId>org.onap.so</groupId> |
| 33 | <artifactId>cxf-logging</artifactId> |
| 34 | <version>${project.version}</version> |
| 35 | |
| 36 | </dependency> |
| 37 | |
| 38 | pom.xml: |
| 39 | +++++++++ |
| 40 | <?xml version="1.0"?> |
| 41 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 42 | |
| 43 | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| 44 | |
| 45 | <modelVersion>4.0.0</modelVersion> |
| 46 | <parent> |
| 47 | |
| 48 | <groupId>org.onap.so</groupId> |
| 49 | <artifactId>so</artifactId> |
| 50 | <version>1.6.0-SNAPSHOT</version> |
| 51 | |
| 52 | </parent> |
| 53 | <name>CXFLogging</name> |
| 54 | <description>Common CXF Logging Classes</description> |
| 55 | <dependencies> |
| 56 | |
| 57 | <dependency> |
| 58 | |
| 59 | <groupId>org.apache.cxf</groupId> |
| 60 | <artifactId>cxf-rt-rs-client</artifactId> |
| 61 | <version>${cxf.version}</version> |
| 62 | |
| 63 | </dependency> |
| 64 | |
| 65 | <dependency> |
| 66 | <groupId>org.apache.cxf</groupId> |
| 67 | <artifactId>cxf-rt-bindings-soap</artifactId> |
| 68 | <version>${cxf.version}</version> |
| 69 | |
| 70 | </dependency> |
| 71 | |
| 72 | <dependency> |
| 73 | |
| 74 | <groupId>org.apache.cxf</groupId> |
| 75 | <artifactId>cxf-rt-transports-http</artifactId> |
| 76 | <version>${cxf.version}</version> |
| 77 | |
| 78 | </dependency> |
| 79 | |
| 80 | <dependency> |
| 81 | |
| 82 | <groupId>javax.servlet</groupId> |
| 83 | <artifactId>javax.servlet-api</artifactId> |
| 84 | |
| 85 | </dependency> |
| 86 | |
| 87 | <dependency> |
| 88 | |
| 89 | <groupId>org.slf4j</groupId> |
| 90 | <artifactId>slf4j-ext</artifactId> |
| 91 | |
| 92 | </dependency> |
| 93 | |
| 94 | <dependency> |
| 95 | |
| 96 | <groupId>org.slf4j</groupId> |
| 97 | <artifactId>slf4j-api</artifactId> |
| 98 | |
| 99 | </dependency> |
| 100 | |
| 101 | </dependencies> |
| 102 | |
| 103 | <build> |
| 104 | <resources> |
| 105 | <resource> |
| 106 | <directory>src/main/resources</directory> |
| 107 | <filtering>true</filtering> |
| 108 | |
| 109 | </resource> |
| 110 | |
| 111 | <resource> |
| 112 | |
| 113 | <directory>src/main/java</directory> |
| 114 | |
| 115 | <includes> |
| 116 | |
| 117 | <include>*.java</include> |
| 118 | |
| 119 | </includes> |
| 120 | |
| 121 | </resource> |
| 122 | |
| 123 | </resources> |
| 124 | |
| 125 | </build> |
| 126 | |
| 127 | <artifactId>cxf-logging</artifactId> |
| 128 | |
| 129 | </project> |
| 130 | |
| 131 | Configuration file: |
| 132 | ++++++++++++++++++++ |
| 133 | Here we can do configure the logger properties for the cxf-logging. |
| 134 | |
| 135 | <configuration> |
| 136 | |
| 137 | <property name="p_tim" value="%d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX", UTC}"/> |
| 138 | |
| 139 | <property name="p_lvl" value="%level"/> |
| 140 | |
| 141 | <property name="p_log" value="%logger"/> |
| 142 | |
| 143 | <property name="p_mdc" value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}"/> |
| 144 | |
| 145 | <property name="p_msg" value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}"/> |
| 146 | |
| 147 | <property name="p_exc" value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}"/> |
| 148 | |
| 149 | <property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}"/> |
| 150 | |
| 151 | <property name="p_thr" value="%thread"/> |
| 152 | |
| 153 | <property name="pattern" value="%nopexception${p_tim}\t${p_thr}\t${p_lvl}\t${p_log}\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t%n"/> |
| 154 | |
| 155 | <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
| 156 | |
| 157 | <encoder> |
| 158 | |
| 159 | <pattern>${pattern}</pattern> |
| 160 | |
| 161 | </encoder> |
| 162 | |
| 163 | </appender> |
| 164 | |
| 165 | <appender name="test" |
| 166 | class="org.onap.so.utils.TestAppender" /> |
| 167 | |
| 168 | <logger name="com.att.ecomp.audit" level="info" additivity="false"> |
| 169 | |
| 170 | <appender-ref ref="STDOUT" /> |
| 171 | |
| 172 | </logger> |
| 173 | |
| 174 | <logger name="com.att.eelf.metrics" level="info" additivity="false"> |
| 175 | |
| 176 | <appender-ref ref="STDOUT" /> |
| 177 | |
| 178 | </logger> |
| 179 | |
| 180 | <logger name="com.att.eelf.error" level="WARN" additivity="false"> |
| 181 | |
| 182 | <appender-ref ref="STDOUT" /> |
| 183 | |
| 184 | </logger> |
| 185 | |
| 186 | <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false"> |
| 187 | <appender-ref ref="STDOUT" /> |
| 188 | |
| 189 | <appender-ref ref="test" /> |
| 190 | |
| 191 | </logger> |
| 192 | |
| 193 | <logger name="org.flywaydb" level="DEBUG" additivity="false"> |
| 194 | <appender-ref ref="STDOUT" /> |
| 195 | |
| 196 | </logger> |
| 197 | |
| 198 | <logger name="ch.vorburger" level="WARN" additivity="false"> |
| 199 | <appender-ref ref="STDOUT" /> |
| 200 | |
| 201 | </logger> |
| 202 | |
| 203 | <root level="WARN"> |
| 204 | <appender-ref ref="STDOUT" /> |
| 205 | <appender-ref ref="test" /> |
| 206 | |
| 207 | </root> |
| 208 | |
| 209 | </configuration> |
| 210 | |