User Community Service Desk Downloads
If you can't find the product or version you're looking for, visit support.ataccama.com/downloads

How to Log Online Services

It is possible to log request and response information related to the following services running on ONE Runtime Server: ONE plans that were published as web services and Native Services (if your solution includes ONE MDM).

There are two approaches available: log full information or only request and response times and specific HTTP headers.

Log full request and response information

You can log all available information, including headers, full request and response bodies, and timestamps into a dedicated log file not managed by the ONE Runtime Server Logging Component. This might be useful during debugging.

Sample logging output from the LoggingFilter
Request started at:26.06.2019 09:10:09.0014
Client: 127.0.0.1:50119
Mime type: text/xml; charset=UTF-8
Request headers:
X-Frame-Options:DENY
SOAPAction:dqf_address
Cache-Control:no-cache, no-store, max-age=0, must-revalidate
X-Content-Type-Options:nosniff
Pragma:no-cache
Expires:0
X-XSS-Protection:1; mode=block
Content-Type:text/xml; charset=UTF-8
Content length: 652
Host: 127.0.0.1(port:50119)
Path:
Method: POST
Query string:
Real number of received bytes: 652
------------ Request body start -----------

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:ns1="http://www.ataccama.com/ws/nme/dqf_address" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
        <ns1:dqf_address>
            <ns1:sourceSystem>crm</ns1:sourceSystem>
            <ns1:record>
                <ns1:attributes>
                    <ns1:source_id>101_Residential_1</ns1:source_id>
                    <ns1:src_type>1</ns1:src_type>
                    <ns1:src_street>81-123 Mt Pleasant Rd</ns1:src_street>
                    <ns1:src_city>Toronto</ns1:src_city>
                    <ns1:src_state></ns1:src_state>
                    <ns1:src_zip>M4W1N4</ns1:src_zip>
                </ns1:attributes>
            </ns1:record>
        </ns1:dqf_address>
    </soapenv:Body>
</soapenv:Envelope>
------------ Request body end -----------


Request was longer than maxRequestLogSize parameter
Response headers:
Response status: 0
Real number of sent bytes: 906
------- Response body start ------

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Body>
    <dqf_addressResponse xmlns="http://www.ataccama.com/ws/nme/dqf_address">
      <record>
        <attributes>
          <source>
            <src_type>1</src_type>
            <src_street>81-123 Mt Pleasant Rd</src_street>
            <src_city>Toronto</src_city>
            <src_zip>M4W1N4</src_zip>
          </source>
          <clean>
            <sco_type>0</sco_type>
            <cio_street>81-123 Mt Pleasant Rd</cio_street>
            <cio_city>Toronto</cio_city>
            <cio_zip>M4W1N4</cio_zip>
            <cio_address_comp>81-123 Mt Pleasant Rd Toronto  M4W1N4</cio_address_comp>
            <meta_label>CA_DISABLED</meta_label>
          </clean>
        </attributes>
      </record>
    </dqf_addressResponse>
  </soapenv:Body>
</soapenv:Envelope>
------- Response body end ------

Response was longer than maxResponseLogSize parameter
Request finished at:26.06.2019 09:10:09.0064
  1. Open the Server Configuration file.

  2. Make sure you have at least one listener defined in the HTTP Dispatcher component.

  3. Under HTTP Dispatcher, add and configure the LoggingFilter in the servletFilters element.

  4. Update the filterChain configuration in the listenerContext element, otherwise no messages are logged:

    • Map the created servletFilter to the appropriate location on the existing filterChain.

    • Create a new filterChain if you want to log information only from a specific path.

For the changes to take effect, restart ONE Runtime Server.

A sample configuration for HttpDispatcher component with new servletFilter named "LoggingFilter" is provided here. Note that in this example, the servletFilter is bound to the filterChain for path "/soapOverHttp/*". This means that only the messages that contain this path in its URL are logged.

<component class="com.ataccama.dqc.web.HttpDispatcher">
    <listeners>
        <listenerBean port="8888" name="default" ... >
            <contexts>
                <listenerContext path="/" htmlErrorPages="false">
                    <filterChains>
                        <filterChain path="/*" filters="securityFilter">
                            <conditions/>
                        </filterChain>
                        <filterChain path="/soapOverHttp/*" filters="LoggingFilter">
                            <conditions/>
                        </filterChain>
                    </filterChains>
                    <securityFilter loginUrl="/sso/login" class="com.ataccama.server.http.security.keycloak.KeycloakSecurity">
                        ...
                    </securityFilter>
                </listenerContext>
            </contexts>
        </listenerBean>
    </listeners>
    <servletFilters>
        <servletFilter logFile="../storage/soap_all.server.log" name="LoggingFilter" maxResponseLogSize="0" appendLog="false" class="com.ataccama.dqc.web.filters.LoggingFilter" maxRequestLogSize="0"/>
    </servletFilters>
</component>

Log request and response times

The HTTP Dispatcher can be configured to log short messages about request and response times of incoming requests and values of selected HTTP headers. This can be achieved by configuring the RequestResponseTimeLogger filter. This type of custom logger generates messages that are passed to ONE Runtime Server and are then managed by the LoggingComponent (the component configuration must be modified accordingly).

See an example message here:

Sample logging output from the RequestResponseTimeLogger
2019.06.26 09:10:09 [INFO]  [HttpDispatcher][RequestLog] [38] 127.0.0.1 Request-response time: 00:00.051, status: 200 - /soapOverHttp/dqf_address - SOAPAction:dqf_address, Host:localhost:8888 [127.0.0.1:50119]

Configure the RequestResponseTimeLogger filter

  1. Open the Server Configuration file.

  2. Make sure you have at least one listener defined in the HTTP Dispatcher component.

  3. Under HTTP Dispatcher, add and configure the RequestResponseTimeLogger in the `servletFilters `element.

  4. Update filterChain configuration in the listenerContext element, otherwise no messages are logged:

    • Map the created servletFilter to the appropriate location on the existing filterChain.

    • Create a new filterChain if you want to log information only from a specific path.

A sample configuration for the HttpDispatcher is provided here:

<component class="com.ataccama.dqc.web.HttpDispatcher">
    <listeners>
        <listenerBean port="8888" name="default" ... >
            <contexts>
                <listenerContext path="/" htmlErrorPages="false">
                    <filterChains>
                        <filterChain path="/*" filters="securityFilter">
                            <conditions/>
                        </filterChain>
                        <filterChain path="/soapOverHttp/*" filters="RequestLog">
                            <conditions/>
                        </filterChain>
                    </filterChains>
                    <securityFilter loginUrl="/sso/login" class="com.ataccama.server.http.security.keycloak.KeycloakSecurity">
                        ...
                    </securityFilter>
                </listenerContext>
            </contexts>
        </listenerBean>
    </listeners>
    <servletFilters>
        <servletFilter level="INFO" appendClientInfo="true" name="RequestLog" class="com.ataccama.dqc.web.filters.RequestResponseTimeLogger">
            <headers>
                <header>SOAPAction</header>
                <header>Host</header>
            </headers>
        </servletFilter>
    </servletFilters>
</component>

Configure the LoggingComponent

After the RequestResponseTimeLogger filter is set up, you need to set up Logging Configuration to catch messages from it.

  1. Open the logging configuration file used by the server: the logging configuration is located in <ATACCAMA_HOME>/server/etc/logback-extension.xml.

  2. Set up a new appender that will be used to write incoming messages. Optionally, you can use an existing appender if you want to include these messages to an existing logfile. In this example, the messages are logged to a separate file soap.server.log.

    <appender name="rolling-log" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>../storage/soap.server.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <fileNamePattern>soap.server-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
            <maxFileSize>100MB</maxFileSize>
            <maxHistory>60</maxHistory>
            <totalSizeCap>2GB</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyy.MM.dd HH:mm:ss} %-7([%level]) %msg%n</pattern>
        </encoder>
    </appender>
  3. Set up a logger corresponding to the filter definition from the previous step. Make sure the logger name corresponds to the Java class that has generated the message and has the following format ataccama.<server_component>.<filter>.

    For example, for messages generated by HttpDispatcher with the RequestLog filter (which is the value of the name attribute in the servletFilter configuration), the logger name would be ataccama.HttpDispatcher.RequestLog. The ataccama prefix is included to all messages that are passed to Logback and are generated by Ataccama Java code.

    <logger name="ataccama.HttpDispatcher.RequestLog" level="info" additivity="false">
        <appender-ref ref="rolling-log" />
    </logger>
For the changes to take effect, restart ONE Runtime Server. Changes to the Logback configuration in logback-extension.xml are periodically refreshed during server runtime.
To debug the Logback configuration in logback-extension.xml, add -Dlogback.debug=true to the JAVA_OPTS.

Was this page useful?