summaryrefslogtreecommitdiffstats
path: root/docs/developer_info/Cxf_Logging.rst
blob: ea2bbf56ce09e3028cf746797d1c45240d777f90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0
.. Copyright 2020 Huawei Technologies Co., Ltd.

CXF-logging:
=============
It is a logging framework from SO. Here basically we are having 2 interceptors which extends AbstractSoapInterceptor.

SOAPLoggingInInterceptor:
+++++++++++++++++++++++++++

* 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.

SOAPLoggingOutInterceptor:
++++++++++++++++++++++++++++
* 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.


cxf-logging Used By below components of SO:
++++++++++++++++++++++++++++++++++++++++++++
The cxf-logging framework is used by below components of so.

mso-openstack-adapter.
mso-requests-db-adapter.
mso-sdnc-adapter.
mso-infrastructure-bpmn.

cxf-logging dependency for using in other components:
++++++++++++++++++++++++++++++++++++++++++++++++++++++
  
  <dependency>
      <groupId>org.onap.so</groupId>
      <artifactId>cxf-logging</artifactId>
      <version>${project.version}</version>

    </dependency>

pom.xml:
+++++++++
<?xml version="1.0"?>
<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>

    <groupId>org.onap.so</groupId>
    <artifactId>so</artifactId>
    <version>1.6.0-SNAPSHOT</version>

  </parent>
  <name>CXFLogging</name>
  <description>Common CXF Logging Classes</description>
  <dependencies>

    <dependency>

      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-rs-client</artifactId>
      <version>${cxf.version}</version>

    </dependency>

    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-bindings-soap</artifactId>
      <version>${cxf.version}</version>

    </dependency>

    <dependency>

      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-transports-http</artifactId>
      <version>${cxf.version}</version>

    </dependency>

    <dependency>

      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>

    </dependency>

    <dependency>

      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-ext</artifactId>

    </dependency>

    <dependency>

      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>

    </dependency>

  </dependencies>

  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>

      </resource>

      <resource>

        <directory>src/main/java</directory>

        <includes>

          <include>*.java</include>

        </includes>

      </resource>

    </resources>

  </build>

  <artifactId>cxf-logging</artifactId>

</project>

Configuration file:
++++++++++++++++++++
Here we can do configure the logger properties for the cxf-logging.

<configuration>

	<property name="p_tim" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;, UTC}"/>

    <property name="p_lvl" value="%level"/>

    <property name="p_log" value="%logger"/>

    <property name="p_mdc" value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}"/>

    <property name="p_msg" value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}"/>

    <property name="p_exc" value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}"/>

    <property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}"/>

    <property name="p_thr" value="%thread"/>

    <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"/>

	<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">

		<encoder>

			<pattern>${pattern}</pattern>

		</encoder>

	</appender>

	<appender name="test"
		class="org.onap.so.utils.TestAppender" />

	<logger name="com.att.ecomp.audit" level="info" additivity="false">

		<appender-ref ref="STDOUT" />

	</logger>

	<logger name="com.att.eelf.metrics" level="info" additivity="false">

		<appender-ref ref="STDOUT" />

	</logger>

	<logger name="com.att.eelf.error" level="WARN" additivity="false">

		<appender-ref ref="STDOUT" />

	</logger>

	<logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
		<appender-ref ref="STDOUT" />

		<appender-ref ref="test" />

	</logger>
	
	<logger name="org.flywaydb" level="DEBUG" additivity="false">
        <appender-ref ref="STDOUT" />

    </logger>

	<logger name="ch.vorburger" level="WARN" additivity="false">
		<appender-ref ref="STDOUT" />

	</logger>

	<root level="WARN">
		<appender-ref ref="STDOUT" />
		<appender-ref ref="test" />

	</root>

</configuration>