Json-api: What should the "reading token" log message every five seconds tell me?
Good afternoon all,
When running the json-api from the command line, I get the below log message every five seconds:
[http-json-ledger-api-akka.actor.default-dispatcher-10] INFO com.daml.auth.TokenHolder - Reading token from .\path\to\token.txt...
There doesn’t seem to be any actual error with the token, and the json api seems to be responding to requests as expected, but these constant messages that aren’t really providing meaningful information are making it difficult to see log messages as part of processing a request.
Does this message mean I made a mistake in my config? Or is it just a status message? Or something in between?
The JSON API periodically reloads the token to handle the case where it expires and you’ve updated it. The log message doesn’t indicate any error, it just means that it is reading the token again so it’s merely a status message.
Thank you!
You can also suppress certain log messages entirely as @cocreature detailed in the post below where he talks about how to do that with sandbox, but it can be done with any command, such as json-api:
java -Dlogback.configurationFile=./your-custom-logback.xml -jar ~/.daml/sdk/1.9.0/daml-sdk/daml-sdk.jar json-api --your-json-api-options
Snippet below but make sure to read the full post.
The other option is to sidestep the assistant completely. Note that this relies on details of the SDK tarball which are not guaranteed to be stable across versions. The JAR invoked by
daml sandboxis located at~/.daml/sdk/$YOUR_SDK_VERSION/daml-sdk/daml-sdk.jar. You can invoke that directly viajava -jar. Since there is a single JAR for the whole SDK you have to passsandboxas the first argument. Putting things together, you can launch sandbox with a given logback config as follows:java -Dlogback.configurationFile=./logback.xml -jar ~/.daml/sdk/1.1.1/daml-sdk/daml-sdk.jar sandbox .daml/dist/foobar-0.0.1.darSidenote
The log statement will be printed whenever it is evaluated. In thew new sandbox, this seems to happen twice (presumably once for validation) so you see the log statement twice as well. In Sandbox classic, it is only printed once.