Logging gRPC calls

Are the calls to the ledger APIs logged and can they be configured if one uses com.daml.ledger.rxjava.DamlLedgerClient?

I guess this depends on the underlying gRPC calls as I did not find explicit logging in our implementations.

I found this SO entry: logging - grpc Logger level - Stack Overflow. Is this my best lead or is there something better, more concrete?

1 Like

If you’re interested in having low-level details, you can configure your logger to use the appropriate level to see Netty’s and gRPC’s logs.

We don’t log anything on the client right now, but currently I’m thinking of adding the possibility of adding interceptors to the client. This would allow you to introduce logging in whichever way would fit your use case. Would that be something you’d find valuable?

1 Like

By interceptors I assume you mean some sort of hooks or listeners. So for example I could add an interceptor and catch all submitAndWait calls to the command client. Whenever such a call occurs my interceptor would be triggered and I could log it or do whatever I want.

Is this what you meant? If so, yes, I think that’d be nice.

Currently I need to log “calls to the ledger API” (deliberately loosely defined). I hoped that I don’t have to explicitly write this into my code, but rather turn on the appropriate logger levels.

1 Like

Right now you can configure the logging for Netty and gRPC to the appropriate level, which would allow you to log every call in great detail.

The bindings do not add logging on top of that, as the user is likely to have the appropriate knowledge of the domain to know what and how to log better contextualized information. If you need better contextualized information, adding logs to your application is the way to go right now.

Regarding the interceptors, unfortunately gRPC’s documentation seems to be fairly lacking in this regard, but they would be something that can be added to a client upon construction that intercepts calls and performs some kind of action. We use them on the server side to perform authentication and logging, but there are also client-side interceptors available in gRPC (docs). This is something that we may add in the future.

1 Like

Please do take a minute to consider the security implications of producing network-level logs, as they are likely to contain all sorts of confidential information.