Using a custom logback.xml for the sandbox

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?

1 Like

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.

1 Like

Thanks. This seems to be an undocumented feature.

2 Likes

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.

1 Like

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.

1 Like