I want to customize logging behaviour for the sandbox and seem to recall there’s a way to specify a custom logback.xml
file. If so, where do I need to place it and how do I instruct the sandbox process to pick it up?
If you’re running the sandbox using the daml assistant, you can pass the path to your custom logback config using the --logback-config /path/to/xml
flag. If you’re running the jar directly, you can pass it using -Dlogback.configurationFile=/path/to/xml
.
Thanks. This seems to be an undocumented feature.
It is indeed undocumented and at the moment unsupported. To clarify, the --logback-config
option is not a flag accepted by the daml sandbox
command, but by the underlying daml-helper run-jar
command, which is itself not documented either.
Here’s a bit of a more complete answer. This is totally unsupported and undocumented; it seems to work as of 1.0.0, but may break at any time.
If you run daml sandbox --unknown-flag
, the sandbox will fail to start and complain about the flag not being known (for obvious reasons). In failing to start, it will show the full command that was run, in my case:
$ daml sandbox --unknown-flag
Error: Unknown option --unknown-flag
Try --help for more information.
daml-helper: Received ExitFailure 1 when running
Raw command: java -Dlogback.configurationFile=/Users/garyverhaegen/.daml/sdk/1.0.0/daml-sdk/sandbox-logback.xml -jar /Users/garyverhaegen/.daml/sdk/1.0.0/daml-sdk/daml-sdk.jar sandbox --unknown-flag
This shows you the raw command, in which you can see how to pass a different logback.xml configuration.
Was testing this out with 2.8.6
canton.
Looks like
daml sandbox --logback-config <my config path>
is not longer the option.
I tried with putting it in daml.yaml
sandbox-options:
- -Dlogback.configurationFile=<my logback file path>
also tried with
JAVA_OPTS="-Dlogback.configurationFile=<my logback file>" daml sandbox
both do not seem to work properly
Wondering can anyone give an update on using daml sandbox with custom logback config
Thanks so much in advance
As discussed with canton team offline,
We can use
JAVA_TOOL_OPTIONS="-Dlogback.configurationFile=<my logback file>" daml sandbox
or
_JAVA_OPTIONS="-Dlogback.configurationFile=<my logback file>" daml sandbox
Thanks @Bas_van_Gijzel @samuel-williams-da1 and @Joao_Sa_Sousa for the fast reponse.