Getting debug outputs from trigger service

Is daml trigger-service capable of showing output messages from debug?

That is, given the no-op trigger from Daml docs:

module NoOp where

import qualified Daml.Trigger as T

noOp : T.Trigger ()
noOp = T.Trigger with
  initialize = pure ()
  updateState = \_ -> pure ()
  rule = \_ -> do
    debug "triggered"
    pure ()
  registeredTemplates = T.AllInDar
  heartbeat = None

How is it possible to make daml trigger-service print “triggered”?


It looks like the default logback file for the trigger service does not enable those logs. However, you can change the logback config just like you would for sandbox (described in How can I make debug statements visible in the sandbox logs? - #2 by cocreature).

Specifically, create a logback based on the default trigger service logback config (you can find that at ~/.daml/sdk/1.18.0/daml-sdk/trigger-service-logback.xml that enables daml.traceLog:

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>

    <logger name="io.netty" level="WARN">
        <appender-ref ref="stderr-appender"/>
    <logger name="io.grpc.netty" level="WARN">
        <appender-ref ref="stderr-appender"/>
    <logger name="daml.tracelog" level="DEBUG" />
    <root level="INFO">
        <appender-ref ref="STDOUT" />

Then start the trigger service with that logback config:

_JAVA_OPTIONS=-Dlogback.configurationFile=/PATH/TO/YOUR/logback.xml daml trigger-service --ledger-host localhost --ledger-port 6865 --dar .daml/dist/foobar-0.0.1.dar

That will emit the tracelog statements. Unfortunately, you cannot see which trigger produced them. I opened Add logging context to daml tracelog stateemnts · Issue #12208 · digital-asset/daml · GitHub to fix that. In the meantime you’ll have to include some context yourself to figure that out.

1 Like