Skip to content
CCPEDIAby Unity Nodes
App Development

Json-api logging with actual json message

3 posts348 viewsLast activity Mar 2022

  1. bartcantOP

    I am troubleshooting a specific customer issue and like to monitor and log the actual json-api messages at the server

    Currently the format of the json-api output is defined by the json-api-logback.xml

    <configuration>
        <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
            <!-- encoders are assigned the type
                 ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
            <encoder>
                <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
            </encoder>
        </appender>
    
        <logger name="io.netty" level="WARN" />
        <logger name="io.grpc.netty" level="WARN" />
        <logger name="ch.qos.logback" level="WARN" />
    
        <root level="INFO">
            <appender-ref ref="STDOUT" />
        </root>
    </configuration>
    

    Can this be configured to contain the actual json-api message ?

    I am using DAML JDK 1.13.1

  2. bartcant

    Maybe the

    –log-encoder json

    argument is solution ? or is this just a conversion of the text logfiles in a json format ?

    In which version of the json-api is this supported ? It appears not available in DAML SDK 1.13.1

  3. Stephen

    As you suspect, --log-encoder json just changes the format of the log output itself.

    Some contents of requests are encoded at --log-level DEBUG; however, nothing logs the contents of every request or response. For that, I would suggest looking to the options of whatever reverse proxy you have set up in front of JSON API.