Is it possible to change the log level for the JSON API jar?

Hi all!

I noticed, when playing with the jar files included in the 1.11.1 release that the daml-on-sql jar provides an argument to set the log level, but the http json api does not provide this argument.

Currently we are running in to issues where the http json api jar is unable to reach the daml-on-sql jar to make that initial connection, but because we cannot change the log level of the http json api jar we cannot get any more information (i.e. about why this connection cannot be made), only the fact that it could not be made.

Is there a way around this issue, or will setting the log level be added to the http json api?

Thank you!

1 Like

Hi @lashenhurst,

My first guess would be that they are running on different machines (/Docker containers) and you forgot to pass the --address flag to the daml-on-sql jar to tell it not to bind on 127.0.0.1 (localhost).

Regarding logs, I don’t think this is is any way supported, but you can configure very fine-grained logging behaviour by passing in a logback config using the logback.configurationFile Java property, as in:

java -Dlogback.configurationFile=/path/to/logback.xml -jar ...

You can use the one in $DAML_HOME/sdk/$VERSION/daml-sdk/json-api-logback.xml as a starting point.

I don’t know if there are logs that would help you though; honestly for connection issues I’d recommend debugging them with netcat first: if

nc -z $LEDGER_HOST $LEDGER_PORT

does not exit with 0, there’s nothing you can do at the JSON API level.

2 Likes

@Gary_Verhaegen what would be the pattern in the json-api-logback.xml to display the actual json-api message.

default pattern is coded as below

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

Hi @bartcant,

I know the option to override the logback config exists, but that’s honestly the limit of my knowledge on the topic.

You may have more luck opening a new topic asking specifically for the format and options of that XML file, but as I mentioned last year I do not think this is in any way supported.